https://github.com/hamlim/redocer
A redo-undo reducer enhancer
https://github.com/hamlim/redocer
hooks react-hooks reducer redux usereducer
Last synced: 2 months ago
JSON representation
A redo-undo reducer enhancer
- Host: GitHub
- URL: https://github.com/hamlim/redocer
- Owner: hamlim
- Created: 2019-07-13T13:47:25.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2026-04-12T16:08:06.000Z (2 months ago)
- Last Synced: 2026-04-12T17:29:28.952Z (2 months ago)
- Topics: hooks, react-hooks, reducer, redux, usereducer
- Language: JavaScript
- Homepage:
- Size: 1.04 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Redocer
_Pronounced: reducer_
A custom reducer enhancer that returns a reducer that handles undo and redo
actions.
### API
```jsx
import makeRedocer from 'redocer'
function reducer(state, action) { ... };
let redoable = makeRedocer(reducer, initialState);
// Regular actions pass through to the original reducer
redoable(state, 'some-action')
// if you have already called the reducer with a custom action
// then you can call it with a `redo` action, returning the previous state
redoable(state, 'redo')
// Once you have redone a change, you can call the reducer with `undo`
redoable(state, 'undo')
```