0.1.3 • Published 6 years ago

@jonstuebe/react-redux-middleware v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

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.

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago