import React from 'react';
import {Router, Route, IndexRoute, browserHistory} from 'react-router';
import {Provider} from 'react-redux';

import {syncHistoryWithStore} from 'react-router-redux';

import App from './pages/App.js';
//import Home from './pages/Home.js';
//import About from './pages/About.js';
//import NotFound from './pages/NotFound.js';
import store from './Store.js';

const createElement = (Component, props) => {
  return (
    <Provider store={store}>
      <Component {...props} />
    </Provider>
  );
};

const getHomePage = (nextState, callback) => {
  require.ensure([], function(require) {
    callback(null, require('./pages/Home.js').default);
  }, 'home');
};

const getAboutPage = (nextState, callback) => {
  require.ensure([], function(require) {
    callback(null, require('./pages/About.js').default);
  }, 'about');
};

const getNotFoundPage = (nextState, callback) => {
  require.ensure([], function(require) {
    callback(null, require('./pages/NotFound.js').default);
  }, '404');
};

const history = syncHistoryWithStore(browserHistory, store);
//const history = browserHistory;

const Routes = () => (
  <Router history={history} createElement={createElement}>
    <Route path="/" component={App}>
      <IndexRoute getComponent={getHomePage} />
      <Route path="home" getComponent={getHomePage} />
      <Route path="about" getComponent={getAboutPage} />
      <Route path="*" getComponent={getNotFoundPage} />
    </Route>
  </Router>
);

export default Routes;

@@ -1120,17 +1120,17 @@
 %0A%0Aconst 
-R
+r
 outes = 
@@ -1134,76 +1134,9 @@
  = (
-) =%3E (%0A  %3CRouter history=%7Bhistory%7D createElement=%7BcreateElement%7D%3E%0A  
+%0A
   %3CR
@@ -1395,16 +1395,116 @@
 /Route%3E%0A
+);%0A%0A%0Aconst Routes = () =%3E (%0A  %3CRouter history=%7Bhistory%7D createElement=%7BcreateElement%7D%3E%0A    %7Broutes%7D%0A
   %3C/Rout
@@ -1534,8 +1534,10 @@
 Routes;%0A
+%0A%0A

fix 'You cannot change <Router routes>' warning