New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

redux-hor

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-hor

Higher-order Reducers for Redux

latest
Source
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

Redux-HOR

Higher-order Redux is a utility belt for Redux that makes heavy use of higher-order reducers to provide:

  • Reduced boilerplate 🔩
  • Increased modularity 📦
  • Development speedup 🚄

Oh, btw... Higher-order reducer is a function that takes a reducer argument and returns a new reducer:

HigherOrderReducer<State, Action> = (innerReducer: Reducer<State, Action>): Reducer<State, Action>

Installation

yarn add redux-hor

Quick start

Here's a standard reducer that we all know an love:

export default function reducer (state = initialState, action) {
  if (action.type === 'UPDATE_AUTHOR') {
    return {
      ...state,
      author: action.payload
    }
  }

  return state
}

Compare it with HoR style:

import { compose, withActionType, withInitialState, mergeState, identity } from 'redux-hor'

export compose(
  onAction('UPDATE_AUTHOR', () => merge({ author: action.payload }))
)(init(initialState))

API docs

Read them here

Keywords

redux

FAQs

Package last updated on 09 Oct 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