" package, when a path is matched, the rendering will stop. If "< is not used, Switch>" package, each matched " Home >Web Front-end >Front-end Q&A >What is the usage of switch in react In react, switch is used to ensure that the route only renders one path, and is used to solve the unique rendering of the route; when using the " The operating environment of this tutorial: Windows 10 system, react version 17.0.1, Dell G3 computer. Every matched In order to solve the unique rendering of route, it is to ensure that the route only renders one path. If If react video tutorial" The above is the detailed content of What is the usage of switch in react. For more information, please follow other related articles on the PHP Chinese website!What is the usage of switch in react
What is the usage of switch in react
<Router history={history}>
<Switch>
<Route path='/home' render={()=>(<div>首页</div>)}/>
<Route path='/home' component={()=>(<div>首页</div>)}/>
</Switch>
</Router>
<Router history={history}>
<Route path='/home' render={()=>(<div>首页</div>)}/>
<Route path='/home' render={()=>(<div>首页</div>)}/>
</Router>
# is not configured ##Recommended learning: "