Skip to content

Instantly share code, notes, and snippets.

@ryanjyost
Created January 4, 2020 23:10
Show Gist options
  • Select an option

  • Save ryanjyost/126fed934bef9a717fbf31d80b3c2a10 to your computer and use it in GitHub Desktop.

Select an option

Save ryanjyost/126fed934bef9a717fbf31d80b3c2a10 to your computer and use it in GitHub Desktop.
Routing example 6
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