Skip to content

Instantly share code, notes, and snippets.

@stexuq
Created May 22, 2020 05:48
Show Gist options
  • Save stexuq/c92d5e45dce719fc1188c46e6c46bf26 to your computer and use it in GitHub Desktop.
Save stexuq/c92d5e45dce719fc1188c46e6c46bf26 to your computer and use it in GitHub Desktop.
Nested Route in react-router-dom v4+
"react-router": "^1.0.3",
"react-router-dom": "^5.2.0",
import {BrowserRouter as Router, Route, Link, Switch} from 'react-router-dom';
// Nested Route
ReactDOM.render(
(
<Router>
<Switch>
<Route path="/tv/show/:id" component={Show} />
<Route exact path="/tv" component={TV} />
<Route exact path="/" component={App}/>
</Switch>
</Router>
), document.getElementById('root')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment