Use Simple Undo - Simple solution to handle undo\redo turned into React Hooks. Read about Hooks feature.
Documentation
https://sandiiarov.github.io/use-simple-undo
Install
Note: React 16.8+ is required for Hooks.
With npm
npm i use-simple-undo
Or with yarn
yarn add use-simple-undo
Usage
import useSimpleUndo from 'use-simple-undo';
const Counter = const state cursor setValue undo redo = ; const value = statecursor; const increment = ; const decrement = ; return <> <div>value</div> <button =>increment</button> <button =>decrement</button> <button =>undo</button> <button =>redo</button> </> ;;