Skip to content

Instantly share code, notes, and snippets.

@jackcallister
Created August 3, 2015 13:04
Show Gist options
  • Save jackcallister/9da37ed95a879dc0f442 to your computer and use it in GitHub Desktop.
Save jackcallister/9da37ed95a879dc0f442 to your computer and use it in GitHub Desktop.
import 'babel/polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route } from 'react-router';
import { reduxRouteComponent, routerStateReducer } from 'redux-react-router';
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import BrowserHistory from 'react-router/lib/BrowserHistory';
import routes from '../shared/components/routes';
import * as reducers from '../shared/reducers/index';
import promiseMiddleware from './middleware/promiseMiddleware';
const history = new BrowserHistory();
const combinedReducers = combineReducers({ router: routerStateReducer, ...reducers });
const createFinalStore = compose(applyMiddleware(thunk), applyMiddleware(promiseMiddleware), createStore);
const store = createFinalStore(combinedReducers);
document.addEventListener('DOMContentLoaded', () => {
ReactDOM.render(
<Router history={history}>
<Route component={reduxRouteComponent(store)} children={routes} />
</Router>,
document.getElementById('app')
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment