I am new to React Router and learn that there are so many ways to redirect a page:
Using
browserHistory.push("/path")import { browserHistory } from 'react-router'; //do something... browserHistory.push("/path");Using
this.context.router.push("/path")class Foo extends React.Component { constructor(props, context) { super(props, context); //do something... } redirect() { this.context.router.push("/path") } } Foo.contextTypes = { router: React.PropTypes.object }In React Router v4, there's
this.context.history.push("/path")andthis.props.history.push("/path"). Details: How to push to History in React Router v4?
I'm so confused by all these options, is there a best way to redirect a page?