UNPKG

qol-hooks

Version:

A collection of React hooks to improve the quality of life of developers.

15 lines (14 loc) 427 B
/** * @description A hook to get the previous value of a variable * @param {any} value The value to get the previous value of * @returns {any} The previous value of the variable * * @example```tsx * const [value, setValue] = useState(0); * const previousValue = usePrevious(value); * setValue(1); * console.log(previousValue); // 0 * ``` */ declare function usePrevious(value: any): any; export default usePrevious;