I have the following code:
import {Route, Switch} from 'react-router-dom';
<Route exact path="/" component={Landing} />
<div className="container">
<Route path="/register" render={() => (
<Register {...this.props} />
)}/>
<Route path="/login" render={() => (
<Login {...this.props}/>
)}/>
<Switch>
<PrivateRoute path="/dashboard" component={Dashboard}/>
</Switch>
<Switch>
<PrivateRoute path="/create-profile" component={CreateProfile}/>
</Switch>
After the user logs in (using /login), he's been redirected to /dashboard.
However, if I remove the <Switch> from the /dashboard, the user is still being redirected to /dashboard but that Dashboard component doesn't get rendered.
So how exactly does that <Switch> work?