Created
January 4, 2020 23:10
-
-
Save ryanjyost/126fed934bef9a717fbf31d80b3c2a10 to your computer and use it in GitHub Desktop.
Routing example 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import { Route, Switch } from "react-router-dom"; // <-- New code | |
| //...route configs don't change... | |
| export default ROUTES; | |
| /** | |
| * Render a route with potential sub routes | |
| * https://reacttraining.com/react-router/web/example/route-config | |
| */ | |
| function RouteWithSubRoutes(route) { | |
| return ( | |
| <Route | |
| path={route.path} | |
| exact={route.exact} | |
| render={props => <route.component {...props} routes={route.routes} />} | |
| /> | |
| ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment