function createElements (history) { const elements = [ <Router key="router" history={history} children={routes} /> ] if (typeof __DEVTOOLS__ !== 'undefined' && __DEVTOOLS__) { /*eslint-disable*/ const DevTools = require('./DevTools') /*eslint-enable*/ elements.push(<DevTools key="devtools" />) } return elements }
render() { return ( <Router history={history}> <Body> <Route component={Navbar} /> <Route component={ModalRoot} /> <Route component={Toasts} /> <Switch> <PrivateRoute exact path="/" component={Dashboard} /> <PrivateRoute path="/users/:username" component={Users} /> <PrivateRoute path="/users" component={Users} /> <PrivateRoute path="/communities/:slug" component={Communities} /> <PrivateRoute path="/communities" component={Communities} /> <PrivateRoute path="/threads" component={Threads} /> </Switch> </Body> </Router> ); }
ReactDOM.render( <Router history={history}> <App> <Route key="index" exact path="/" render={(props) => <IndexPage cubejsApi={cubejsApi} {...props} />} /> <Route key="story" path="/stories/:storyId" render={(props) => <StoryPage cubejsApi={cubejsApi} {...props} />} /> <Route key="statistics" path="/statistics" render={(props) => <StatisticsPage cubejsApi={cubejsApi} {...props} />} /> <Route key="search" path="/search" render={(props) => <SearchPage cubejsApi={cubejsApi} {...props} />} /> </App> </Router>, // eslint-disable-next-line no-undef document.getElementById('root') );
render() { const { store, routing, history } = this.props; return ( <Provider store={store}> <div> <Router history={history}> {routing} </Router> </div> </Provider> ); }
const Root = () => ( <Router history={browserHistory} routes={Routes} render={applyRouterMiddleware(useRelay)} environment={Relay.Store} /> )
render() { const { store, routing, history } = this.props; return ( <Provider store={store}> <div> <Router history={history}> {routing} </Router> <DevTools /> </div> </Provider> ); }
const WrappedApp = (props) => ( <ContextWrapper {...props}> <Router history={browserHistory} > {routes} </Router> </ContextWrapper> )
render() { if (this._isCheckingInitialLogIn) { return (<Login />); } return ( <Router history={history}> <Route path="/main" component={TodoApp} onEnter={this.checkAuth} /> <Route path="/login" component={Login} /> <Route path="*" onEnter={this.handleRedirect} /> </Router> ); }
match({history: __history__, routes}, (error, redirectLocation, renderProps) => { ReactDOM.render( <Provider store={Store}> <Router {...renderProps}/> </Provider>, document.getElementById('app') ) })
ReactDOM.render( <Provider store={store}> <Router onUpdate={() => window.scrollTo(0, 0)} history={browserHistory}> <Route path="/" component={App}> <IndexRoute component={Home} />; <Route path="/about" component={About} /> </Route> </Router> </Provider> , document.getElementById('react-root'));
render() { return ( <Router history={browserHistory}> {this.props.routes()} </Router> ); }
render() { return <Router history={browserHistory} routes={routesConfig} render={(props) => <AsyncProps {...props}/>} />; }
render () { console.log(this.props.state); return ( <Router history={browserHistory}> <Route path="/" component={AppRoot}> <Route path="about" component={About} /> <Route path="*" component={NoMatch} /> </Route> </Router> ); }
render( <Provider store={store}> <Router history={history} routes={routes} onUpdate={() => window.scrollTo(0, 0)} /> </Provider>, document.getElementById('app'));
ReactDOM.render( <Provider store={store}> <Router onUpdate={() => window.scrollTo(0, 0)} history={browserHistory} routes={routes} /> </Provider> , document.getElementById('react-root'));