most likely root causes for global state getting reset to initialState for each component?

Viewed 21

I have a Redux Toolkit implementation which is currently configured for my React Nextjs app. ComponentX is wired up to set values to global state. I have some test code which writes out the current global state object variable to the console and have validated that ComponentX is successfully updating all of those properties as expected.

ComponentX has a "next" button which redirects to ComponentY which imports the same slice used by ComponentX and accesses properties on that same global state object variable which were set in ComponentX. However, the current behavior that I'm seeing is that the global state object variable properties accessed by ComponentY have been reset to the values that were configured as part of the initialState for that slice. Any idea what the most likely potential root causes for this might be?

0 Answers
Related