@jonstuebe/react-redux-middleware

0.1.3 • Public • Published

React Redux Middleware

This is two basic middlewares for the all React api driven react-redux

Install

npm

npm i -s @jonstuebe/react-redux-middleware

or yarn

yarn add @jonstuebe/react-redux-middleware

Importing

ES6

import { logger, thunk } from "@jonstuebe/react-redux-middleware";

ES5 (CommonJS)

const { logger, thunk } = require("@jonstuebe/react-redux-middleware");

ES5 (UMD Build)

var thunk = ReactReduxMiddleware.thunk;
var logger = ReactReduxMiddleware.logger;

Usage

thunk

Just like redux, react-redux does not handle async action creators as those can be handled by middleware. Thus thunk.

Writing thunks

const thunk = (a, b) => {
  return dispatch => {
    setTimeout(() => {
      dispatch({
        type: "TEST",
        a,
        b
      });
    }, 3000);
  };
};

logger

By adding the logger you'll get very basic logging in your console.

Readme

Keywords

none

Package Sidebar

Install

npm i @jonstuebe/react-redux-middleware

Weekly Downloads

0

Version

0.1.3

License

MIT

Last publish

Collaborators

  • jonstuebe