Created
February 13, 2016 19:42
-
-
Save marr/36cdbe52acd38de9045e to your computer and use it in GitHub Desktop.
React router with simple redux props
This file contains 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
// imports go here... | |
// Assume prop{1,2} are sent in via props. I use react-router-redux for this. | |
const Page = ({ children, prop1, prop2 }) => ( | |
<div> | |
<Menu /> | |
<Content { prop1, prop2 }> | |
{children} | |
</Content> | |
</div> | |
) | |
// Routes (Provider comes from react-router-redux). | |
<Provider { store }> | |
<Router { history }> | |
<Route path="/" component={Page}> | |
<Route path="foo" component={Foo} /> | |
<Route path="bar" component={Bar} /> | |
</Route> | |
</Router> | |
</Provider> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment