import * as React from "react"; import type { AnyFunction } from "./~utils.js"; /** * SSR-safe wrapper over `React.useLayoutEffect`. * * @see https://fb.me/react-uselayouteffect-ssr * * @private */ export declare const useLayoutEffect: typeof React.useLayoutEffect; /** * Wrapper over `useState` that always gives preference to the * controlled state (which often comes from a prop). * * This is helpful when a component needs to support both uncontrolled * and controlled states. If controlled value/setter is not passed, * then it will work just like a regular `useState`. * * ```tsx * const [state, setState] = useControlledState( * props.defaultValue, * props.value, * props.onChange * ); * ``` * * @private */ export declare function useControlledState(initialValue: T, controlledState: T | undefined, setControlledState?: React.Dispatch>): readonly [T, React.Dispatch>]; /** * Hook that keeps track of the latest value in a ref. * This is useful for referencing unmemoized values inside Effects. * * ```tsx * const valueRef = useLatestRef(props.value); * ``` * * @private */ export declare function useLatestRef(value: T): React.RefObject; /** * Returns a memoized callback ref that merges the provided refs. * * ```tsx * const mergedRef = useMergedRefs(ref1, ref2); * ``` * * This is useful when you need to internally use a ref in a component * and also need to forward its ref. * * ```tsx * const internalRef = useRef(null); * return
; * ``` * * @private */ export declare function useMergedRefs(...refs: ReadonlyArray | React.LegacyRef | undefined | null>): (instance: T | null) => void; /** * Hook that "memoizes" a function by skipping reactivity, similar to `React.useEffectEvent`. * * The memoization technique used by this hook ensures that only the "latest" callback is ever called, * regardless of its dependencies. The "latest" callback is stored in a ref and updated on each render * in an Effect. The result is that the callback passed to this hook does not need to be memoized. * * @private */ export declare function useUnreactiveCallback(callback: T | undefined): T; /** * Hook that accepts a list of event handlers and returns a single memoized (unreactive) * handler that ensures `defaultPrevented` is respected for each handler. * * Example: * ```tsx *