Last active
February 7, 2017 07:56
-
-
Save KrissieV/b34a9d0fc42c64bd6f5b6be4ca11ccdb to your computer and use it in GitHub Desktop.
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
// ReactRouter dynamic paths | |
var routes = ( | |
<Router history={browserHistory} onUpdate={logPageView}> | |
<Route path="/" component={App} > | |
<IndexRoute component={Home} /> | |
<Route path=":page" component={Page} /> | |
</Route> | |
</Router> | |
) | |
// Excerpt from Page Component to match path with menu items | |
var pagePath = this.props.params.page; | |
var row = [] | |
this.state.menuItems.items.map(function(item) { | |
var link = item.url.replace(siteVars.siteURL+'/',''); | |
var path = link.replace('/',''); | |
if (path == pagePath) { | |
row.push(<PageContents key={item.object_id} pageID={item.object_id} />); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment