Last active
March 27, 2018 04:33
-
-
Save whs/a112efe418b7cbcf091769bf7bee8224 to your computer and use it in GitHub Desktop.
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 App = ({route}) => { | |
| let routeMetadata = routesMap[route.name]; | |
| let Component = routeMetadata && routeMetadata.component; | |
| return <Component {...route.data} /> | |
| }; | |
| export default routeNode('')(App); | |
| // in routes | |
| const routes = [ | |
| { | |
| name: 'home', | |
| path: '/', | |
| component: Loadable({ loader: () => import(/* webpackChunkName: 'home' */ '../pages/home'), loading: Loading }), | |
| fetch: (state, { api }) => api.getHome(), | |
| } | |
| ] |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If nested route supported is required