lore-hook-redux

Generates the Redux Store from all the reducers

Example Usage

This hook essentially just breaks up the standard Redux store creation process into a single of functions that can be overridden on a per-environment basis, so that you don't have to override the entire store creation process.

For example, in some environments (like development) you might want to override just the middleware, and apply apply a store enhancer to enable the Redux DevTools, but leave the rest of the creation process the same.

This standard Redux Store build process looks like this:

import { compose, applyMiddleware, combineReducers, createStore } from 'redux';
import { thunk } from 'redux-thunk';

const middleware = [thunk];
const enhancer = compose(
  applyMiddleware.apply(null, middleware)
);
const rootReducer = combineReducers(reducers);
const preloadedState = {};
const store = createStore(rootReducer, preloadedState, enhancer);

// expose store on Lore instance
lore.store = store;

Overview

This config file allows you to modify how Redux is constructed.

Example Config File

import { applyMiddleware } from 'redux';
import { thunk } from 'redux-thunk';

export default {
  middleware: [
    applyMiddleware(thunk)
  ]
};

Configuration Options

middleware

What middleware you want Redux to use.