@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
10 lines (9 loc) • 566 B
TypeScript
import { type DependencyList } from 'react';
/**
* Executes a layout effect until a specified condition is met.
* Similar to useEffectUntil but uses useLayoutEffect for synchronous execution before DOM updates.
* The effect stops running once it returns true.
* @param effect - A function that returns a boolean indicating whether the condition is met
* @param dependencies - Dependency array for the layout effect
*/
export declare const useLayoutEffectUntil: <Dependencies extends DependencyList>(effect: () => boolean, dependencies?: Dependencies) => void;