Answer the question
In order to leave comments, you need to log in
How to render a common template for pages in React Router?
Good afternoon, There is a site frame in the MainLayout component that accepts {this.props.children} It was possible to nest in the react-router
libraries , as you can see, I create a Route and specify the MainLayout template for it and all the descendants that will be specified in it will be transferred like {this.props.children} .
How to do the same in the react-router-dom library ?
ReactDOM.render((
<Router>
<Route component={MainLayout}>
<Route path="/" component={Home} />
<Route component={SearchLayout}>
<Route path="users" component={UserList} />
<Route path="widgets" component={WidgetList} />
</Route>
</Route>
</Router>
), document.getElementById('root'));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question