How to redirect with a reactive router while maintaining the original request parameters?

In my routes I

<Route>
    <Redirect from="/" to="/view/something"/>
    ...
</Route>

But if I click on the root URL with rooturl/?query=somequery, I will lose the request parameter after the redirect. How to save all request parameters after redirection?

+4
source share
1 answer

Hope this helps: https://github.com/rackt/react-router/issues/1034

Here you can specify and reuse existing query parameters after redirection as follows:

<Redirect from="/foo/:id" to="/bar/:id"/>( idwill be reused).

, / - . onEnter onLeave. docs.

-1

Source: https://habr.com/ru/post/1625569/


All Articles