@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
11 lines (10 loc) • 563 B
TypeScript
import { type DependencyList } from 'react';
/**
* Memoizes the input value and preserves it throughout the component's lifetime.
* Similar to useMemo but with an empty dependency array, ensuring the value is computed only once.
* Useful for maintaining stable references to objects or expensive computations.
* @typeParam T - The type of the value to memoize
* @param input - The value to memoize
* @returns The memoized value that remains constant across re-renders
*/
export declare const useMemorize: <T>(input: T, dependencies?: DependencyList) => T;