mobx-router-react
Usage
// Note that <Outlet/> is rendered at the App component level. // This will allow any matched child route to also be rendered. // If you need to block child rendering you can do that by not rendering // the <Outlet/> element. const App = <div> <header>Acme Inc</header> <Outlet/> </div> const Home = <div> <h1>Home</h1> </div> const About = <div> <h1>About</h1> </div> routerstart { ReactDOM }
Components
RouterProvider
Provides the router context
Link
Used to navigate
Outlet
Used to render routes at each depth.
Decorators
withRouter
injects router context into component props.
Configuration
component
ReactComponent
A react component to render when the route is matched
outlet
string
An optional named outlet to render this route into, ie. 'modal'
animate
boolean, default: false
Do you wish to use built in animation features for this route. Specify a data-transition-ref
attribute on the node you are animating otherwise the Component root node will be used for detecting the transitionend
event.