Reactjs React.js中的导航
我在React.js中完成导航栏时遇到问题 我正在使用“react router dom”:“^5.0.1”Reactjs React.js中的导航,reactjs,Reactjs,我在React.js中完成导航栏时遇到问题 我正在使用“react router dom”:“^5.0.1” 函数导航(){ 返回( 关于 摄影 ); } 当我点击“关于”或“摄影”时,什么都没有发生。只是正在更改的URL。有人能帮我吗?试着用这种方式定义路由器 <Router history={history}> <Switch> <Route path="/about" component={About} />
函数导航(){
返回(
- 关于
- 摄影
);
}
当我点击“关于”或“摄影”时,什么都没有发生。只是正在更改的URL。有人能帮我吗?试着用这种方式定义路由器
<Router history={history}>
<Switch>
<Route path="/about" component={About} />
<Route path="/photography" component={Photography} />
</Switch>
</Router>
<Router history={history}>
<Switch>
<Route path="/about" component={About} />
<Route path="/photography" component={Photography} />
</Switch>
</Router>