https://github.com/pwlmc/redux-hor
Higher-order Reducers for Redux
https://github.com/pwlmc/redux-hor
higher-order-component higher-order-reducers reducer redux redux-hor
Last synced: 5 months ago
JSON representation
Higher-order Reducers for Redux
- Host: GitHub
- URL: https://github.com/pwlmc/redux-hor
- Owner: pwlmc
- License: mit
- Created: 2018-08-13T16:30:06.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-03-24T06:47:32.000Z (over 1 year ago)
- Last Synced: 2025-04-26T16:58:58.758Z (about 1 year ago)
- Topics: higher-order-component, higher-order-reducers, reducer, redux, redux-hor
- Language: TypeScript
- Size: 303 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Redux-HOR
-----
[](https://circleci.com/gh/pwlmaciejewski/redux-hor/tree/master)
[](https://codecov.io/gh/pwlmaciejewski/redux-hor)
[](https://badge.fury.io/js/redux-hor)
[](https://renovatebot.com/)
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:
```typescript
HigherOrderReducer = (innerReducer: Reducer): Reducer
```
## Installation
```
yarn add redux-hor
```
## Quick start
Here's a standard reducer that we all know an love:
```typescript
export default function reducer (state = initialState, action) {
if (action.type === 'UPDATE_AUTHOR') {
return {
...state,
author: action.payload
}
}
return state
}
```
Compare it with HoR style:
```typescript
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](./API.md)