TK-95
TK-95

Reputation: 1170

Redirect to route redux

I use react-redux-router, and I try to make redirection. But I don't now how to do this correctly. Only solution what I know is dispatching "@@router/LOCATION_CHANGE" event, but it seems to not correct. Is there better way to do redirection?

Upvotes: 0

Views: 375

Answers (1)

bryanph
bryanph

Reputation: 1012

A redirect when visiting a route can be done with the Redirect component; check https://github.com/reactjs/react-router/blob/master/docs/API.md#redirect.

For a redirect in the app itself, check push() from react-router-redux (you seem to be using this library): https://github.com/reactjs/react-router-redux#pushlocation-replacelocation-gonumber-goback-goforward

Upvotes: 1

Related Questions