Replies: 1 comment 1 reply
-
I don't know... But, if (count === 0) {
setCount(1);
} it may violate rules of React. It's safer to use useEffect(() => {
if (count === 0) {
setCount(1);
}
}) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Test Environment
When I use
useAtom
in client component and setter in rendering process, it hydrates same component twice.Why this kind of issue occurs?
This client component code inserted into RSC(
layout.tsx
of Next.js). When I runnpm run dev
and refresh several times, it renders 2 component in same page.⬇️ Reproduction & Video
reproduction.mov
CodeSandbox ➡️
Did I something wrong?
Thanks for reading!
Beta Was this translation helpful? Give feedback.
All reactions