@safe-global/safe-react-hooks
Version:
A collection of React Hooks that facilitates the interaction of React apps with Safe Smart Accounts
14 lines • 406 B
JavaScript
import { useEffect, useRef } from 'react';
/**
* Hook to get the previous value of a given variable.
* @param value Value to get the previous value from.
* @returns Previous value of the given variable.
*/
export function usePrevious(value) {
const ref = useRef();
useEffect(() => {
ref.current = value;
}, [value]);
return ref.current;
}
//# sourceMappingURL=usePrevious.js.map