Repository navigation
v1.4.1
In this release, we're excited to introduce a new functionality - the usePrevious hook. This hook allows you to easily retain and utilize the previous value of a state variable.
Additions
usePrevious hook: Provides a way to get the previous value of a state variable. This can be handy in cases where the current value of a variable needs to be compared to its previous value.
Usage
import usePrevious from 'react-hook-kit';
const YourComponent = () => {
const [count, setCount] = React.useState(0);
const prevCount = usePrevious(count);
//... your logic
}In the example above, prevCount will always contain the previous value of count.
Special thanks to SynDevUI for their contributions to this release.