Created
April 10, 2020 14:56
-
-
Save nesbtesh/e55704a936b9bf8570cc4f0b2840adff 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 = ({ routes, initialData, initialToken, menus }) => ( | |
<Switch> | |
{routes.map((route, index) => { | |
// pass in the initialData from the server or window.DATA for this | |
// specific route | |
return ( | |
<Route | |
key={index} | |
path={route.path} | |
exact={route.exact} | |
render={props => | |
React.createElement(route.component, { | |
...props, | |
privateTemplate: route.private, | |
initialToken: initialToken, | |
jsonSettings: initialData[initialData.length -2], | |
initialData: initialData ? initialData[index] : null, | |
})} | |
/> | |
); | |
})} | |
</Switch> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment