我正在App组件中渲染<Navbar />
,然后渲染<Home />
,然后渲染。
这两个组件都有点重叠,而应该像
相继。我该怎么做?
render() {
return (
<div className="container">
<Navbar />
<Switch>
<Route path="/home" component={Home}/>
<Redirect to="/home"/>
</Switch>
</div>
);
}
home组件是
const Home = (props)=>{
return( <h1>hello</h1>)
}
我只使用了Bootstrap。