@sanity/form-builder
Version:
Sanity form builder
15 lines • 567 B
TypeScript
/**
* A hook for doing side effects as a response to a change in a hook value between renders
* Usage:
* ```js
* useDidUpdate(hasFocus, (hadFocus, hasFocus) => {
* if (hasFocus) {
* scrollIntoView(elementRef.current)
* }
* })
* ```
* @param current The value you want to respond to changes in
* @param didUpdate Callback to run when the value changes
*/
export declare function useDidUpdate<T>(current: T, didUpdate: (previous: T, current: T) => void, compare?: (previous: T, current: T) => boolean): void;
//# sourceMappingURL=useDidUpdate.d.ts.map