Line
<Route path="/:user" component={User}/>
means that everything after /will be transferred to the this.props.params.usercomponent variable componentand User.
, path path=, , . , /, , , User User, . , , this.props.params.user "about" , , , .
, , , , , <Switch>, .
, , <Switch>:
A), /about,
<Route path="/about" component={About}/>
, About .
B), /something,
<Route path="/about" component={About}/>
, :
<Route path="/:user" component={User}/>
, User something this.props.params.user param, .
C) /
<Route path="/about" component={About}/>
<Route path="/:user" component={User}/>
,
<Route component={NoMatch}/>
NoMatch.
, <Switch>, /about:
<Route path="/about" component={About}/>
, , /about.
<Route path="/:user" component={User}/>
, , /, .
<Route component={NoMatch}/>
, , .