Answer the question
In order to leave comments, you need to log in
How to do nesting in react router?
Tell me how to work with nested pages in the router? I want the content inside the home to be displayed by the link, that is, like this home / services.
home and contacts work, and service returns a blank page
Code for the service component
class MainBar extends Component {
render(){
return(
<div className="center_container">
<Route path="/service" component={Service} />
</div>
)
}
}
/home
/Services
/Contacts
Answer the question
In order to leave comments, you need to log in
Have you looked at the log in the console, errors? You can generally fill in here in the sandbox, through codesandbox the same, it will be faster.
And on topic. You just write like "Render this component to me if there is a /service path", of course it will not be able to go to home/service, it will only work on the path /service
Look in the match.url dock
https://reacttraining.com/react -router/web/example... An example is in the const Topics doc
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question