diff --git a/src/App.jsx b/src/App.jsx index 3d8fca5605..854ab61733 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -73,75 +73,57 @@ class App extends Component { render () { const { config, isNavOpen } = this.state; - const { navLabel = '', routeGroups = [] } = this.props; - - const header = ( - this.onNavToggle()} - logo={( - - )} - toolbar={( - - - - - - - this.onDevLogout()} - /> - - - - )} - /> - ); - - const sidebar = ( - - - {routeGroups.map(params => ( - - ))} - - - )} - /> - ); + const { + render, + routeGroups = [], + navLabel = '', + } = this.props; return ( this.onNavToggle()} + logo={( + + )} + toolbar={( + + + + + + + + + + + )} + /> + )} + sidebar={( + + + {routeGroups.map(params => ( + + ))} + + + )} + /> + )} > - { - // - // Extract a flattened array of all route params from the provided route config - // and use it to render route components. - // - // [{ routes }, { routes }] -> [route, route, route] -> () - // - routeGroups - .reduce((allRoutes, { routes }) => allRoutes.concat(routes), []) - .map(({ component: Component, path }) => ( - ( - - )} - /> - )) - } + { render ? render({ routeGroups }) : '' } ); diff --git a/src/index.jsx b/src/index.jsx index bfd56e2960..04cb57b6c8 100644 --- a/src/index.jsx +++ b/src/index.jsx @@ -235,6 +235,21 @@ export async function main () { ], }, ]} + render={({ routeGroups }) => ( + routeGroups + .reduce((allRoutes, { routes }) => allRoutes.concat(routes), []) + .map(({ component: PageComponent, path }) => ( + ( + + )} + /> + )) + )} /> )} />