Keep alive routes #71
-
I'm working on implementing a feature that preserves component state between route navigations using your library. I'd like components/routes to remain "alive" when a user navigates away, so that when they return to that route later, all state is preserved exactly as they left it. The router naturally unmounts components when navigating away from a route, which loses their state. I know this is kinda an anti-pattern, but it has its pros in terms of UX. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
My bad, just now saw this post! 😔 So yea, interesting need heh.. By state, do you mean variable values? or, the dom itself & et al? I'd imagine I'm not too sure that a router should be in charge of that to be honest. |
Beta Was this translation helpful? Give feedback.
My bad, just now saw this post! 😔
So yea, interesting need heh..
By state, do you mean variable values? or, the dom itself & et al?
I'd imagine
localStorage
would be handy enough but then you'd have to roll the hydration & such.I'm not too sure that a router should be in charge of that to be honest.
But maybe we could share a prop with a key/id to identify the state object in
localStorage
?