Use of useLayoutEffect causes errors with SSR #955
-
Bug DescriptionI'm currently incorporating valtio in a Remix project utilizing SSR. When the server rendering runs, I receive the error below. I was able to resolve this by patching the package to use useEffect instead of useLayoutEffect during the server side render (like this). Should a patch like this be incorporated into the library?
Reproduction Linkhttps://stackblitz.com/edit/remix-run-remix-ipk4mq?file=app%2Froutes%2F_index.tsx |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi, thanks for reporting. |
Beta Was this translation helpful? Give feedback.
-
Ah, yes I see that in the docs now. Thanks! |
Beta Was this translation helpful? Give feedback.
Hi, thanks for reporting.
To be precise, it's a false-positive warning. React 19 won't have it. But it's annoying with React 18.
See #652 (reply in thread) and our suggestion is #944.