-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Closed
Description
In 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 React-Router V4 .
In below example when the server returns a success, the user is taken to the Cart page
// actions/index.js
export function addProduct(props) {
return dispatch =>
axios.post(`${ROOT_URL}/cart`, props, config)
.then(response => {
browserHistory.push('/cart'); // no longer in React Router V4
});
}How can I make a redirect to the page from function in React Router v4?
I can find lot of references on navigation from components in my case i need to navigate from a function
Telokis, lucasfcosta, azizunsal, n3dst4, heyjunlin and 21 more
Metadata
Metadata
Assignees
Labels
No labels