Steven Musumeche Steven Musumeche - 5 months ago 90
React JSX Question

Redirect to another route after submission success

I'm using redux-form and react-router. Redux-form provides a method called

which is called after successful submission. However, I don't have access to the router in that method.

How can I redirect to a new route using react-router after a successful submission?


I would suggest you use container component for this. Once your form is submitted, dispatch an action and in that action use browserHistory to change or replace the route.

//container code
function mapDispatchToProps(dispatch){
    onSubmit : () =>{


//action code
 function updateData(){
    //update state if needed
    browserHistory.push(//changed route)