You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The suggested way of storing the store in a useRef does not follow the guidelines from React. That is, we are not supposed to set the value of current during rendering.
Do not write or read ref.current during rendering.
Not quite sure. I managed to create the store outside the component just fine with NextJS client component. Unsure what side-effects that will have. But it seems to work just fine since nothing in the store is SSR or RSC.
The text was updated successfully, but these errors were encountered:
Also, definitely do not create a store for usage in Next.js outside of a component. Your components will SSR and this can have all kinds of weird consequences.
What docs page needs to be fixed?
What is the problem?
The suggested way of storing the store in a
useRef
does not follow the guidelines from React. That is, we are not supposed to set the value of current during rendering.Here's the piece of code from the documentation:
What should be changed to fix the problem?
Not quite sure. I managed to create the store outside the component just fine with NextJS client component. Unsure what side-effects that will have. But it seems to work just fine since nothing in the store is SSR or RSC.
The text was updated successfully, but these errors were encountered: