In the current version of React Router (v3) I can accept a server response and use browserHistory.push
to go to the appropriate response page. However, this isn
If you want to use history while passing a function as a value to a Component's prop, with react-router 4 you can simply destructure the history
prop in the render attribute of the
Component and then use history.push()
(
{
this.YourClassMethod()
history.push('/')
}}>
)} />
Note: For this to work you should wrap React Router's BrowserRouter Component around your root component (eg. which might be in index.js)