Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 577 Bytes

NavigatingOutsideOfComponents.md

File metadata and controls

16 lines (13 loc) · 577 Bytes

Navigating Outside of Components

While you can use this.props.router from withRouter to navigate around, many apps want to be able to navigate outside of their components. They can do that with the history the app gives to Router.

// your main file that renders a Router
import { Router, browserHistory } from 'react-router'
import routes from './app/routes'
render(<Router history={browserHistory} routes={routes}/>, el)
// somewhere like a redux/flux action file:
import { browserHistory } from 'react-router'
browserHistory.push('/some/path')