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
If I have multiple containers and I need to reset the state to initialState of each one upon let say when a user logs out. What is the best way of doing this? Not having each container's Provider on the App component makes this a bit challenging... Loving the library so far - just running into these little quirks. Open to suggestions and maybe other ways of tackling this problem. Thanks!
The text was updated successfully, but these errors were encountered:
Great question. In my experience, this is where "events" come into play -- where one component can listen for dispatched events from another component. IMO this is where this library falls down -- it ties function execution to state manipulation too closely.
Redux-like solutions really shine here.
Event dispatching/listening is incredibly powerful. In your case, maybe and Auth component dispatches "auth/logout" event, and other components listen for "auth/logout" and do whatever they need to do, eg initialState. (This ability is why I use rematch on top of redux.)
In the situation where you need to clear multiple containers when a user logs out you just need to make sure that all the <StateContainer.Provider>s you want to clear are unmounted when a user logs out.
If I have multiple containers and I need to reset the state to initialState of each one upon let say when a user logs out. What is the best way of doing this? Not having each container's Provider on the App component makes this a bit challenging... Loving the library so far - just running into these little quirks. Open to suggestions and maybe other ways of tackling this problem. Thanks!
The text was updated successfully, but these errors were encountered: