7

In my routes I have

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

But if I hit the root url with rooturl/?query=somequery I lose the query paremeter after the redirect. How can I preserve all query parameters after redirect?

1

1 Answer 1

-2

I hope it will help: https://github.com/rackt/react-router/issues/1034

Here you can specify and reuse your existing query params after redirect like this:

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

Also you might want to have some hooks right before/after transition is actually done for some kind of routing management. It's possible to do with onEnter and onLeave hooks. You can read about it in official docs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.