React Hook nearly identical to use-immer, but it returns the draft from the update function.
APACHE-2.0 License
React Hook nearly identical to use-immer, but it returns the draft from the update function.
npm i use-immer-produce immer
const [testObj, updateTestObj] = useImmerProduce({
value: 14
});
In order to immediately extract the draft, before re-render:
const draft = updateTestObj((draft) => {
draft.value = 75;
});
All contributions are welcome, please open an issue or pull request.
To use this repository:
npm i -g pnpm
(if don't have pnpm installed)pnpm i
npx projen
(this will ensure everything is setup correctly, and you can run this command at any time)npx projen build
at any time to build the project.