How to push to History in React Router v4?

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't available in v4, and I'm not sure what the appropriate way to handle this is.

In this example, using Redux, components/app-product-form.js calls this.props.addProduct(props) when a user submits the form. When the server returns a success, the user is taken to the Cart page.
// actions/index.js export function addProduct(props) { return dispatch =>`${ROOT_URL}/cart`, props, config) .then(response => { dispatch({ type: types.AUTH_USER }); localStorage.setItem('token',; browserHistory.push('/cart');
// no longer in React Router V4 }); }

How can I make a redirect to the Cart page from function for React Router v4?

Write your answer...

It's not the same without you

Join the community to find out what other Ednsquare users are discussing, debating and creating.