0.0.7 • Published 6 years ago

redux-hor v0.0.7

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

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

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago