-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
새로고침 시에도 추가 질문 유지 #168
새로고침 시에도 추가 질문 유지 #168
Conversation
Bundle SizesCompared against be296b6 Route: No significant changes found Dynamic import: No significant changes found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👍
src/hooks/storage/useLocalStorage.ts
Outdated
const [hasMounted, setHasMounted] = useState(false); | ||
|
||
useEffect(() => { | ||
setHasMounted(true); | ||
}, []); | ||
|
||
if (hasMounted) { | ||
return [storedValue, setValue] as const; | ||
} | ||
|
||
return [initialValue, setValue] as const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const [hasMounted, setHasMounted] = useState(false); | |
useEffect(() => { | |
setHasMounted(true); | |
}, []); | |
if (hasMounted) { | |
return [storedValue, setValue] as const; | |
} | |
return [initialValue, setValue] as const; | |
const isMounted = useRef(false); | |
useDidMount(() => { | |
isMounted.current = true; | |
}); | |
if (isMounted.current) { | |
return [storedValue, setValue] as const; | |
} | |
return [initialValue, setValue] as const; |
이렇게 useRef
와 useDidMount
를 사용하면 어떨까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 좋습니다! 감사합니다 ㅎㅎ
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #168 +/- ##
==========================================
+ Coverage 92.39% 92.52% +0.13%
==========================================
Files 38 38
Lines 276 281 +5
Branches 51 52 +1
==========================================
+ Hits 255 260 +5
Misses 21 21
☔ View full report in Codecov by Sentry. |
Deploying with
|
Latest commit: |
957387e
|
Status: | ✅ Deploy successful! |
Preview URL: | https://759cb68a.na-lab.pages.dev |
Branch Preview URL: | https://feat-create-dialog.na-lab.pages.dev |
🤔 해결하려는 문제가 무엇인가요?
�새로고침 시에도 추가 질문 유지
🎉 변경 사항
useLocalStorage
훅을 사용하였어요.useLocalStorage
훅에서 hydration 오류가 발생해, 해결하였습니다.