is an exact property under Route, react all routes can be matched to the matching routing components, exact matching can be made more stringent routes (a bool value is exact).
<Route path='/' component={Home} />
<Route path='/page' component={Page}>
// In this case, if the matching routing path = '/ page', then the Home will also show up.
// both routing path = '/ page' will match routing path = '/' and the routing path = '/ page'
<Route exact path='/' component={Home} />
<Route path='/page' component={Page} />
Such route matching // path = '/ page', the only match Page assembly
<Redirect exact from='/' to='/profile'/>
When a user accesses an interface that does not exist, this time with Redirect redirect and re-assembly of a jump in our custom.
Redirect redirected to the last sentence on the Switch
export default class RouteConfig extends Component { render () { return ( <HashRouter> <Switch> <Route path="/profile" exact component= {profile}/> <Route path="/login" component= {login}/> <Route path="/info" component= {info}/> <Route path="/msite" component= {msite}/> <Route path="/setuser" component= {setUser}/> <Route path="/shop/:id" component= {shop}/> <Route path="/food/:geohash/:id/:title" component= {food}/> <Route path="/technology" component= {technology}/> <Redirect exact from='/'to = '/ profile' /> // Redirect Switch redirected to put the last one </ Switch> </ HashRouter> ) } }