before using react-router v3 when setting the primary route is / Home, as long as the parameter is not set, / Home/asd will not match, jump to 404, but after upgrading v4, / Home primary route, no parameters, no stator route, / Home/asd will also match to / Home if the sub-route set by strict mode exact, does not match? So how do you configure it in v3 mode?
this is the configuration of the primary route
<HashRouter >
<div>
<Switch>
{/* */}
<Route path="/Home" component={Home} />
{/* 404 */}
<Route component={NotFound}/>
</Switch>
</div>
</HashRouter>
this is the configuration of child routes
<Switch>
<Route path="/Home/firstchild" component={HomeChildFirst} />
</Switch>
find a curve-saving method, and add a 404 page route at the bottom of the sub-route
<Switch>
<Route path="/Home/firstchild" component={HomeChildFirst} />
<Route component={NotFound}/>
</Switch>
but this is troublesome and cannot be unified.
in addition, the main route / Home, does not write the : prop
parameter. When matching the route, if there is something after it, such as / Home/asddd, it will be processed as a parameter asddd, but this parameter is not available on the Home page.
react router v4