react, react-router-dom exact strict

There have been routing changes, but 2 components are rendered on the same route at the same time

exist

react-router-dom added an exact attribute after the update, which is of type bool

When exact == true, / one and / one / two do not match
When exact == false, / one and / one / two match

So this kind of problem occurred, without setting exact, / one will match / one route and / root route, so two components appeared

1
2
3
4
5

<Router>
     <Route path="/" exact component={App}> </Route>
     <Route path="/details/" component={QuestionDetails}> </Route>
</Router>

strict

strict means whether to match the trailing slash path

If true, /one and /one/ do not match

Persist in original technology sharing, your support will encourage me to continue to create!