什么是使用的优势Match和Miss部件免受react-router过Router组件?我似乎在react-router docs中找不到关于此的任何文档。
Match
Miss
react-router
Router
我的问题源于更准确地通过查看以下内容来查看react-universally样例:https : //github.com/ctrlplusb/react-universally
<Match>并且<Miss>是React Router v4的Alpha版本中的组件。
<Match>
<Miss>
在Beta中,<Match>已重命名<Route>(其道具也已更改,因此 pattern现在path和exactly现在exact)。该<Miss>组件已完全删除。相反,您应该使用一条<Switch>语句,该语句仅呈现匹配的第一个<Route>(或个<Redirect>)。您可以将无路径组件添加为<Switch>的路由的最后一个子组件,并且当前一个都不<Route>匹配时,它将呈现。
<Route>
pattern
path
exactly
exact
<Switch>
<Redirect>
您可以查看API文档以了解更多详细信息。
<Switch> <Route exact path='/' component={Home} /> <Route path='/about' component={About} /> // The following <Route> has no path, so it will always // match. This means that <NoMatch> will render when none // of the other <Route>s match the current location. <Route component={NoMatch} /> </Switch>