-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Docs]: Programmatic redirect example #10192
Comments
You can do this inside of a |
I need to do it in a service layer. This is why I opened the ticket and explained why. |
/reopen |
hard to find but heres an answer, I wish I found it earlier before figuring out by myself 😅 |
@rsmelo92 I wouldn't use that approach unless you're trying stuff out, working on a proof of concept or a hobby. They're not really planning on maintaining it: https://reactrouter.com/en/6.4.0-pre.14/routers/history-router |
Can we re-open this ticket? I've been waiting a for a stable, long term solution for this issue for at least a year. |
Describe what's incorrect/missing in the documentation
Sometimes it is required to programmatically control state of application router.
For example, external events driven by timer or websockets event might force loading of different route.
This actual for various monitoring applications. E.g. security camera interfaces with object/event detection etc.
Usually this code lives outside of components in a service layer and requires some kind of forceful redirect. Which we can always use
history.pushState
it doesn't seems like an elegant solution.Ideally it would be nice to have something like
The text was updated successfully, but these errors were encountered: