aboutsummaryrefslogtreecommitdiff
path: root/src/client/react
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/react')
-rw-r--r--src/client/react/index.js16
-rw-r--r--src/client/react/lib/reduxMiddleware.js11
2 files changed, 16 insertions, 11 deletions
diff --git a/src/client/react/index.js b/src/client/react/index.js
index f01a361..22afe3b 100644
--- a/src/client/react/index.js
+++ b/src/client/react/index.js
@@ -23,13 +23,12 @@ import 'whatwg-fetch';
import React from 'react';
import ReactDOM from 'react-dom';
-import { createStore, applyMiddleware, compose as reduxCompose } from 'redux';
-import thunk from 'redux-thunk';
+import { createStore, compose as reduxCompose } from 'redux';
import moment from 'moment';
import createHistory from 'history/createBrowserHistory';
-import makeGetHistory from './lib/getHistory';
+import makeReduxMiddleware from './lib/reduxMiddleware';
import reducer from './store/reducers';
import App from './App';
import './index.scss';
@@ -40,18 +39,13 @@ moment.locale('nl');
const history = createHistory();
+// Redux devtools extension
+// https://github.com/zalmoxisus/redux-devtools-extension
const compose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || reduxCompose;
const store = createStore(
reducer,
- // Redux devtools extension
- // https://github.com/zalmoxisus/redux-devtools-extension
- compose(
- applyMiddleware(thunk.withExtraArgument({
- getHistory: makeGetHistory(history),
- moment,
- })),
- ),
+ compose(makeReduxMiddleware({ history })),
);
ReactDOM.render(
diff --git a/src/client/react/lib/reduxMiddleware.js b/src/client/react/lib/reduxMiddleware.js
new file mode 100644
index 0000000..c153022
--- /dev/null
+++ b/src/client/react/lib/reduxMiddleware.js
@@ -0,0 +1,11 @@
+import moment from 'moment';
+import { applyMiddleware } from 'redux';
+import thunk from 'redux-thunk';
+import makeGetHistory from './getHistory';
+
+export default function makeReduxMiddleware({ history }) {
+ return applyMiddleware(thunk.withExtraArgument({
+ getHistory: makeGetHistory(history),
+ moment,
+ }));
+}