Skip to content

Instantly share code, notes, and snippets.

@codervince
Created July 8, 2017 03:39
Show Gist options
  • Save codervince/cf21cf7ff7fdf404517e0e8cbf595f82 to your computer and use it in GitHub Desktop.
Save codervince/cf21cf7ff7fdf404517e0e8cbf595f82 to your computer and use it in GitHub Desktop.
//MainLayout
const linkStyle={activeStyle: {color:'red'}}
export const MainLayout = props => {
<div>
...
//default Default loser
<Link to="/greeting/loser/default" {...LinkStyle}> Welcome,. Loser</Link>
//magic taken care of by REACT ROUTER see nested Routes in Router index.js
{props.children || 'please select a sub-page'}
//GreetingPage,js
export const GreetingPage = props = {
Hello {props.params.firstname} {props.params.lastname}
);
//404.js
export const 404 = props = {
//some HTML
);
//index.js
import {Router, Route, hashHistory} from 'react-router'
import {MainLayout} from 'MainLayout'
ReactDOM.render(
<Provider store={store}
<Router history={hashHistory}
<Route path-"/" component={mainLayout}
<Route path-"/listing" component={ReduxApp}
<Route path-"/greeting/:lastname/:firstname" component={GreetingPage}
<Route path-"*" component={404}
)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment