Warning on using Zustand
See original GitHub issueI’m trying out Zustand with Aleph and get this warning on render:
Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.
at People (file:///Users/aadams/Projects/ms-email/.aleph/development/components/People.js#/components/People.tsx@1818f4:7:20)
at main
at App (file:///Users/aadams/Projects/ms-email/.aleph/development/app.js#543810:5:31)
Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.
at People (file:///Users/aadams/Projects/ms-email/.aleph/development/components/People.js#/components/People.tsx@1818f4:7:20)
at main
at App (file:///Users/aadams/Projects/ms-email/.aleph/development/app.js#543810:5:31)
$ aleph --version
aleph.js 0.3.0-alpha.22
deno 1.8.2
v8 9.0.257.3
typescript 4.2.2
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Managing React state with Zustand - LogRocket Blog
Learn how to use Zustand for managing and persisting state within React apps, as well as comparing Zustand to Redux, Jotai, and Recoil....
Read more >zustand - NPM Package Overview - Socket.dev
Start using Socket to analyze zustand and its 1 dependencies to secure your app ... :warning: This readme is written for JavaScript users....
Read more >zustand setState callback function - reactjs - Stack Overflow
If you want to update some React component that uses `useFooBar`, you have to call setState // to let React know that an...
Read more >Troubleshooting Guide - React Flow
This guide contains warnings and errors that can occur when using React Flow. ... Warning: Seems like you have not used zustand provider...
Read more >Using zustand in react - performance pains - Realfiction
Using zustand in react - performance pains; Using zustand in react ... pretty usable but with some sensitive, um senses you will notice...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@aadamsx
This is the way most frameworks like Next and Gatsby do to. It isn’t something that we can change - your just going to have to look on how you change the loading of the state management library.
@ije so what does SSR mode actually mean in the Aleph context?
The library that’s causing the
useLayoutEffect
error is actually the redux-like state management library Zustand library I’m importing. I’ve imported this into the/lib
directory as you can see here: https://github.com/aadamsx/aleph-error3/blob/master/lib/useStore.tsHow do you handle this situation? I need the client-side state-management library in this component: https://github.com/aadamsx/aleph-error3/blob/master/components/People.tsx, but of course it loads server side due to the way Aleph renders.