geostyler
Version:
Framework for styling geodata
19 lines (18 loc) • 507 B
TypeScript
/**
* Hook to store a state value for comparison in a useEffect hook.
* e.G.
* ```
* const [value, setValue] = useState();
* const previousValue = usePrevious(value);
*
* useEffect(() => {
* if(value.a !== previousValue.a) {
* // do something
* }
* }, []);
* ```
*
* @param value The variable value that should be stored.
* @returns The previously stored variable value.
*/
export declare const usePrevious: <T extends unknown>(value: T) => T | undefined;