type Dispose = () => void; export type ReactionOptions = Partial<{ /** * @default */ memoize: false; } | { memoize: true; }>; /** * Reaction dispose callback, that executes when deps function is rotten */ type ReactionDispose = () => void; /** * Creates a reactive effect that runs the given function whenever any of the dependencies change. * * `reaction` is enhanced version of this: * ```ts * effect(() => { * const value = deps(); * untracked(() => fn(value)); * }); * ``` * * @param deps A function that returns the dependencies for the effect. * @param fn A function that runs the effect. It receives the dependencies and an options object with a `isFirst` property that is `true` on the first run of the effect. * @param options A options object that contains `memoize` prop that tells should deps function result be memoized * @returns A function that can be called to dispose of the effect. */ export declare const reaction: (deps: () => T, fn: (dep: T, options: { isFirst: boolean; }) => void | ReactionDispose, options?: ReactionOptions) => Dispose; /** * Creates a reactive effect that runs the given function whenever any of the dependencies change **in requestAnimationFrame**. * * * @param deps A function that returns the dependencies for the effect. * @param fn A function that runs after deps changes in next requestAnimationFrame. It receives the dependencies and an options object with a `isFirst` property that is `true` on the first run of the effect. * @param options A options object that contains `memoize` prop that tells should deps function result be memoized * @returns A function that can be called to dispose of the effect. */ export declare const rafReaction: (deps: () => T, fn: (dep: T, options: { isFirst: boolean; }) => void, options?: ReactionOptions) => Dispose; export {};