The simplest answer is just to move Home
into the render() method of your app, like so:
class App extends Component {
render() {
return (
<Home />
);
}
}
Then, in your routes at the top, you could just have this:
<Router>
<div>
<Route exact path="/" component={App}/>
<Route path="/Project" component={Project}/>
</div>
</Router>
However, it depends on what you want to do, exactly. Does the App
always have Home
as a child component? Otherwise, you can nest your inner component within the router like so:
This would set the props.children of the App to be the specific component that you are trying to use. That could be then used within your App like so:
class App extends Component {
render() {
return (
<MyHeaderComponent />
{this.props.children}
<MyFooterComponent />
);
}
}