Managing state with two simultaneously open routes #10860
Replies: 1 comment 2 replies
-
If you want both |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have an interesting Router usage here, where there is a situation when both of my routes CAN BE visible simultaneously.
This is possible when creating a web app using something like Electron or Tauri, where Router is used to show different views in different windows. The problem is that I personally haven't found a way to somehow trigger the
<App />
reload after something has been changed within a different route. And router itself does not seem to be able to support that.There is a
<SettingsProvider />
context provider withuseSettings(): [Settings, Dispatch<SetStateAction<Settings>>]
hook. When I try to use that to modify my app's settings through the/omeditor
route - it does not affect the root route at all.The change would occur something like this:
/omeditor
and presses "Save"setSettings()
which derives fromuseSettings()
/omeditor
and/
rootes are being changed, triggering a re-renderBut settings are being changed only within
/omeditor
route and nowhere else.So... Am I missing something, and is it possible with React Router or am I better off looking for something else here?
Beta Was this translation helpful? Give feedback.
All reactions