import type { Func } from "doc-editor-utils"; import type { DependencyList, EffectCallback, MutableRefObject, SetStateAction } from "react"; /** * 当前组件挂载状态 */ export declare const useIsMounted: () => { isMounted: () => boolean; mounted: MutableRefObject; }; /** * 安全地使用 useState * @param value 状态 * @param mounted 组件挂载状态 useIsMounted */ export declare const useMountState: (value: S, mounted: MutableRefObject) => readonly [S, (next: SetStateAction) => undefined]; /** * 安全地使用 useState * @param value 状态 */ export declare const useSafeState: (value: S) => readonly [S, (next: SetStateAction) => undefined]; /** * State 与 Ref 的使用与更新 * @param value 状态 */ export declare const useStateRef: (value: S) => readonly [S, (next: S) => undefined, MutableRefObject]; /** * 避免挂载时触发副作用 * @param effect 副作用依赖 */ export declare const useUpdateEffect: (effect: EffectCallback, deps?: DependencyList) => void; /** * 保证 re-render 时的同一函数引用 * @param fn Func.Any */ export declare const useMemoFn: (fn: T) => T;