Skip to content

Instantly share code, notes, and snippets.

@GriffinHeart
Created March 22, 2016 04:30
Show Gist options
  • Save GriffinHeart/a6f97af37259be633235 to your computer and use it in GitHub Desktop.
Save GriffinHeart/a6f97af37259be633235 to your computer and use it in GitHub Desktop.
//client side
match({ routes, location }, (error, redirectLocation, renderProps) => {
render(
<Provider store={store}>
<ContextHolder context={context}>
<Router {...renderProps} children={routes} history={Location} />
</ContextHolder>
</Provider>,
appContainer
);
});
//server side
match({ routes, location: req.url }, (error, redirectLocation, renderProps) => {
data.body = ReactDOM.renderToString(
<Provider store={store}>
<ContextHolder context={context}>
<RouterContext {...renderProps} />
</ContextHolder>
</Provider>
);
});
//routes
<Route>
<Route path="login" component={LoginPage} />
<Route path="/" component={App} >
<IndexRoute component={Dashboard} />
<Route path="transaction/:id" component={ConsumerTransaction}/>
<Route path="about" getComponent={getContextComponent} />
<Route path="privacy" getComponent={getContextComponent} />
</Route>
<Route path="*" component={NotFoundPage} />
</Route>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment