How Redux works with Nextjs #4572
Unanswered
bhubavenski
asked this question in
Q&A
Replies: 1 comment 6 replies
-
React might reexecute any of your components for any reason at any time. What you might take for granted today can change tomorrow - there is absolutely no official guarantee that your RootLayout only executes once. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello! My question is all about “Do we actually need to keep ref of the store and create the store with makeStore()” What I mean: even if we do not use useRef and makeStore, if we load the store in the root layout, which is requested only once, during the serving of the entry point and during client navigation, this layout is not requested again, only the page is requested. This means that we stay with one layout for the entire life of the application, which means that we can create a store without a ref, because the only time we will get a new layout is when we refresh the browser, which will also reset the store , which is correct behaviour. If we create the store into the root layout then there is no reason to make track of it with useRef, because the root layout is persisted between navigation
Beta Was this translation helpful? Give feedback.
All reactions