import TopicReducer from "reducers/topicReducer";
import thunkMiddleware from "redux-thunk";
import {createStore, combineReducers, applyMiddleware} from 'redux';
import createLogger from 'redux-logger';

const loggerMiddleware = createLogger();

/**
 * Creates the topic store.
 *
 * This is designed to be used isomorphically.
 * @returns {*}
 */
export default function topicStore() {
    const reducer = combineReducers({TopicReducer});
    const store = createStore(reducer, applyMiddleware(thunkMiddleware, loggerMiddleware));
    return store;
};

import TopicReducer from "reducers/topicReducer";
import thunkMiddleware from "redux-thunk";
import {createStore, combineReducers, applyMiddleware} from 'redux';
import createLogger from 'redux-logger';

const loggerMiddleware = createLogger();

const createTopicStore = function createTopicStore(middlewares, reducers) {
    const reducer = combineReducers(reducers);
    const store = createStore(reducer, applyMiddleware(...middlewares));
    return store;
};

/**
 * Creates the topic store.
 *
 * This is designed to be used isomorphically.
 * @returns {*}
 */
export default function topicStore() {
    return createTopicStore([thunkMiddleware, loggerMiddleware], {TopicReducer});
};

Make store creation more flexible.
Make store creation more flexible.

This will help us to create stores with no logging middleware later if we want (amongst other things).
