Last active
October 20, 2016 12:48
-
-
Save tomitrescak/97820edd951979af4b498cb585c3057f 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
import { BrowserRoute, Match, Miss } from 'react-router'; | |
import { MainLayout, HomePage, Other } from './components'; | |
const MatchWithMainLayout = ({ exactly, pattern, component: Component }: any) => { | |
return ( | |
<Match exactly={exactly} pattern={pattern} render={(props: any) => ( | |
<MainLayout><Component {...props} /></MainLayout> | |
)} /> | |
); | |
}; | |
const AppRoutes = () => { | |
return ( | |
<BrowserRouter> | |
<div> | |
<MatchWithMainLayout exactly pattern="/" component={HomePage} /> | |
<MatchWithMainLayout pattern="/:foo/bar" component={(props: any) => <Other {...props} foo="bar" />} /> | |
<Miss component={NotFound} /> | |
</div> | |
</BrowserRouter> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment