reactjs - Redirect to another route after submission success -


i'm using redux-form , react-router. redux-form provides method called onsubmitsuccess called after successful submission. however, don't have access router in method.

how can redirect new route using react-router after successful submission?

i suggest use container component this. once form submitted, dispatch action , in action use browserhistory change or replace route.

//container code function mapdispatchtoprops(dispatch){   return{     onsubmit : () =>{         dispatch(updatedata())    }  }  }  //action code  function updatedata(){     //update state if needed     browserhistory.push(//changed route)  } 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -