nelreina
9/12/2016 - 9:00 PM

Redux Store Setup

Redux Store Setup

import React from 'react';
import { render } from 'react-dom';
import App from './App';
import 'babel-polyfill';
import { Provider } from 'react-redux';
import store from './store';
render(
  <Provider store={store}>
    <App />
  </Provider>,
  document.querySelector('#root')
);
import storeConfig from './store-config';

const initialState = {};

export default storeConfig(initialState);
import { createStore, applyMiddleware, compose  } from 'redux';
import thunk from 'redux-thunk';

import rootReducer from './rootReducer';

export default (initialState = {}) => {

	const devTools = window.devToolsExtension ? window.devToolsExtension() : undefined;
  const middelwares = applyMiddleware(thunk);

	let enhancer;
	if (devTools) {
		enhancer = compose(middelwares, devTools);
	} else {
		enhancer = compose(middelwares);
	}

	return createStore(rootReducer, initialState, enhancer);

};
import { combineReducers } from 'redux';

export default combineReducers({
  default: (state ={}, action) => state
})