File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ import { BrowserRouter } from 'react-router-dom';
44import { Provider } from 'react-redux' ;
55
66import App from './components/App' ;
7- import store from './store' ;
7+ import createStore from './store' ;
8+
9+ const store = createStore ( ) ;
810
911ReactDOM . render (
1012 (
Original file line number Diff line number Diff line change @@ -3,9 +3,13 @@ import thunk from 'redux-thunk';
33
44import reducer from '../reducers' ;
55
6- // Redux Thunk middleware allows you to write action creators that return a
7- // function instead of an action. The thunk can be used to delay the dispatch
8- // of an action, or to dispatch only if a certain condition is met. The former
9- // is the case for XSnippet Web since we need to fetch data via HTTP API first
10- // and then dispatch it to store.
11- export default redux . createStore ( reducer , redux . applyMiddleware ( thunk ) ) ;
6+ function createStore ( ) {
7+ // Redux Thunk middleware allows you to write action creators that return a
8+ // function instead of an action. The thunk can be used to delay the dispatch
9+ // of an action, or to dispatch only if a certain condition is met. The
10+ // former is the case for XSnippet Web since we need to fetch data via HTTP
11+ // API first and then dispatch it to store.
12+ return redux . createStore ( reducer , redux . applyMiddleware ( thunk ) ) ;
13+ }
14+
15+ export default createStore ;
You can’t perform that action at this time.
0 commit comments