react-use-history-state
v0.0.2
Published
react's useState with buffer for previous values
Downloads
3
Maintainers
Readme
Install
npm install react-use-history-state
Quickstart
export default function App() {
const [state, setState, history] = useHistoryState<number>(5, 1000);
useEffect(() => {
setState(5);
setState(4);
setState(3);
}, []);
return (
<div>
{history.map((elem: number) => (
<p>{elem}</p>
))}
</div>
);
}