Skip to content

Commit

Permalink
fix: 러블리 테마도 useEffect 사용
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcjy committed Sep 19, 2024
1 parent a32464d commit 312dc4e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions components/LovelyCalendar.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
'use client'
import { useMemo, useState, useCallback } from 'react'
import { useMemo, useState, useCallback, useEffect } from 'react'
import Link from 'next/link'
import { ChevronLeft, ChevronRight, Heart } from 'lucide-react'
import { BibleData, DayData } from './calendar/types'

export const LovelyCalendar = ({ bibleData }: { bibleData: BibleData }) => {
const [currentDate, setCurrentDate] = useState(new Date())
const today = useMemo(() => new Date(), [])
const [calendar, setCalendar] = useState<DayData[]>([])
const [today, setToday] = useState(new Date())

const CALENDAR_TITLE = '주내힘교회 청소년부'
const CALENDAR_SUBTITLE = '성경읽기표'
Expand Down Expand Up @@ -73,10 +74,10 @@ export const LovelyCalendar = ({ bibleData }: { bibleData: BibleData }) => {
[bibleData, today]
)

const calendar = useMemo(
() => createCalendar(currentDate),
[currentDate, createCalendar]
)
useEffect(() => {
const calendar = createCalendar(currentDate)
setCalendar(calendar)
}, [currentDate])

const changeMonth = useCallback((d: number) => {
setCurrentDate(
Expand Down

0 comments on commit 312dc4e

Please sign in to comment.