Launch Week Day 3: Introducing Organization Notifications in Socket.Learn More
Socket
Book a DemoSign in
Socket

@malfaitrobin/redux-one-of-types

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@malfaitrobin/redux-one-of-types

Redux utilities

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

oneOfType npm version npm downloads

Handle multiple types with the same reducer function.

Installation

With yarn:

yarn install @malfaitrobin/redux-one-of-types

With npm:

npm install --save @malfaitrobin/redux-one-of-types

Usage

import { createReducerCreator } from "@malfaitrobin/redux";
import { oneOfTypesMiddleware, oneOf } from "@malfaitrobin/redux-one-of-types";

const createReducer = createReducerCreator(
  oneOfTypesMiddleware /* ...other middleware */
);

const defaultState = {
  value: 0
};

const reducer = createReducer(
  {
    // This method will be executed whenever an action with { type: 'FOO' } or { type: 'BAR' } is dispatched.
    [oneOf("FOO", "BAR")]: (state, action) => {
      return state;
    }
  },
  defaultState
);

FAQs

Package last updated on 03 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts