Access the previous value of a variable with this React hook
npm install @rooks/use-previous```
npm install rooks
or
``
yarn add rooks
Rooks is completely treeshakeable and if you use only 1 of the 50+ hooks in the package, only that hook will be bundled with your code. Your bundle will only contain the hooks that you need. Cheers!
!Build Status   
``
npm install --save @rooks/use-previous
`javascript`
import usePrevious from "@rooks/use-previous";
`jsx
function Demo() {
const myInput = useInput("hello world");
const previousValue = usePrevious(myInput.value);
return (
Current value is {myInput.value}
Previous value was {previousValue || "-"}
);
}
render(
``
| Argument | Type | Description |
| -------- | ---- | -------------------------------------------------- |
| value | any | The variable whose previous value should be stored |
