Skip to content

Commit

Permalink
🐛 시계 탭에서 0으로 초기화된 시간이 잠깐 보여지는 현상을 제거하기 위해 useEffect를 useLayoutEffect로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
alittlekitten committed Jun 16, 2024
1 parent 0c39cd9 commit 18490d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/useClock.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect } from "react";
import { useLayoutEffect } from "react";
import useTimeManage from "./utils/useTimeManage";
import { useSelector } from "react-redux";
import { RootState } from "@src/store";
Expand All @@ -7,7 +7,7 @@ const useClock = () => {
const { time, setTime, playTimeout } = useTimeManage();
const { hour12 } = useSelector((state: RootState) => state.clockReducer);

useEffect(() => {
useLayoutEffect(() => {
const now = new Date(Date.now());
playTimeout.current = setTimeout(() => {
setTime({
Expand Down

0 comments on commit 18490d0

Please sign in to comment.