@winglet/react-utils
Version:
React utility library providing custom hooks, higher-order components (HOCs), and utility functions to enhance React application development with improved reusability and functionality
17 lines (16 loc) • 1 kB
TypeScript
/**
* Returns a snapshot of the object that only updates when the object actually changes.
* Uses deep equality comparison to determine if the object has changed.
* @param input - The object to create a snapshot of
* @param omit - Properties to omit from the comparison
* @returns The current snapshot value of the object
*/
export declare const useSnapshot: <Input extends object | undefined>(input: Input, omit?: Set<keyof Input> | Array<keyof Input>) => Input;
/**
* Returns a ref containing a snapshot of the object that only updates when the object actually changes.
* Uses deep equality comparison to determine if the object has changed.
* @param input - The object to create a snapshot of
* @param omit - Properties to omit from the comparison
* @returns A ref containing the current snapshot of the object
*/
export declare const useSnapshotReference: <Input extends object | undefined>(input: Input, omit?: Set<keyof Input> | Array<keyof Input>) => import("react").RefObject<Input>;