Skip to content

Instantly share code, notes, and snippets.

@puppybits
Created February 7, 2016 19:09
Show Gist options
  • Save puppybits/5d4ba6d340ae1b5652e8 to your computer and use it in GitHub Desktop.
Save puppybits/5d4ba6d340ae1b5652e8 to your computer and use it in GitHub Desktop.
let { Router, Route } = ReactRouter;
let App = require('App');
// routes
var routes = {
path: '/',
component: App,
onEnter: (router, replaceWith) => {
if (router.location.pathname === '/') {
replaceWith(null, '/one');
}
},
childRoutes:[
{
path:"/one",
getComponents:(a, cb) => require.ensure([], require => {cb(null, require("pages/PageOne"));})
},
{
path:"/two",
getComponents:(a, cb) => require.ensure([], require => {cb(null, require("pages/PageTwo"));})
},
]
};
module.exports = routes;
@jerrylau91
Copy link

This is awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment