@meadow/redux-ensure-fsa

2.0.0 • Public • Published

Redux Ensure Flux Standard Action Middleware

redux-ensure-fsa provides a middleware function to use as part of the redux dispatch chain. It is intended for use in development only to check that all actions at the end of the chain follow the Flux Standard Action protocol.

Installation

npm install @meadow/redux-ensure-fsa

Usage

import { createStore, applyMiddleware } from 'redux';
import ensureFSAMiddleware from '@meadow/redux-ensure-fsa';
import thunkMiddleware from 'redux-thunk';

let middleware = [thunkMiddleware];

if (process.env.NODE_ENV !== 'production') {
  const fsaMiddleware = ensureFSAMiddleware({
    ignore: function (action) {
      return false;
    }
  })

  middleware = [...middleware, fsaMiddleware];
}

const createStoreWithMiddleware = applyMiddleware(...middleware)(createStore);

ghit.me

/@meadow/redux-ensure-fsa/

    Package Sidebar

    Install

    npm i @meadow/redux-ensure-fsa

    Weekly Downloads

    1

    Version

    2.0.0

    License

    MIT

    Last publish

    Collaborators

    • jwickens
    • kalli8
    • rickharrison
    • scottagarman
    • harrisonlee
    • fauntleroy
    • meadow-org