Last active
August 7, 2019 12:47
-
-
Save dagron/9cd4b738bf7c15874df273bbc19f9316 to your computer and use it in GitHub Desktop.
react
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
| const switchRoutes = (mix_props) => ( | |
| <Switch> | |
| {routes.map((prop, key) => { | |
| if (prop.layout === "/admin") { | |
| return ( | |
| <Route | |
| path={prop.layout + prop.path} | |
| component={(route_props) => <prop.component {...route_props, ...mix_props} />} | |
| key={key} | |
| /> | |
| ); | |
| } | |
| return null; | |
| })} | |
| <Redirect from="/admin" to="/admin/dashboard" /> | |
| </Switch> | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment