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
Has anyone done any work to sync NuclearJS state to React Router query parameters?
I currently do router.transitionTo() with the new URL query params whenever an action changes some state that is associated with a query param. The way I currently did it though, I need to put all my related state in the same module, which is not great (pretty sure I can fix this though).
Going the other way, when the URL changes for any reason (e.g., user presses Back, or types in a new URL) I hook off of React Router's willTransitionTo() and fire an action to update the state from the current URL parameters. I have a check in there to avoid making any changes if the URL parameters match the current state so I don't get an infinite cycle of changes.
Has anyone done any work to use this sort of pattern (or similar) in a cleaner way?
The text was updated successfully, but these errors were encountered:
Has anyone done any work to sync NuclearJS state to React Router query parameters?
I currently do
router.transitionTo()
with the new URL query params whenever an action changes some state that is associated with a query param. The way I currently did it though, I need to put all my related state in the same module, which is not great (pretty sure I can fix this though).Going the other way, when the URL changes for any reason (e.g., user presses Back, or types in a new URL) I hook off of React Router's
willTransitionTo()
and fire an action to update the state from the current URL parameters. I have a check in there to avoid making any changes if the URL parameters match the current state so I don't get an infinite cycle of changes.Has anyone done any work to use this sort of pattern (or similar) in a cleaner way?
The text was updated successfully, but these errors were encountered: