7
votes

I found two ways to configure redux createStore ,
1.https://github.com/TeamWithBR/SampleProjectTodo/blob/master/src/store/configureStore.js 2.https://github.com/aknorw/piHome/blob/9f01bc4807a8dfe2a75926589508285bff8b1ea6/app/configureStore.js

And I try it , both can work

test1

import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware } from 'redux';
import { Router, browserHistory } from 'react-router';
import reduxThunk from 'redux-thunk';
import routes from './routes';
import App from './components/app';
import reducers from './reducers';


const createStoreWithMiddleware = applyMiddleware(reduxThunk)(createStore);

ReactDOM.render( 
    <Provider store={createStoreWithMiddleware(reducers)}>
      <Router history={browserHistory} routes={routes} />
    </Provider>, document.querySelector('#app'));

test2

const createStoreWithMiddlewareTest = createStore(reducers, applyMiddleware(reduxThunk));

ReactDOM.render(
  <Provider store={createStoreWithMiddlewareTest}>
    <Router history={browserHistory} routes={routes} />
  </Provider> , document.querySelector('#app'));

But I don't know what's the difference between them?? Please guide me