UNPKG

abon

Version:

Flexible state management for React 🚀

11 lines (10 loc) • 761 B
import React from "react"; import { UnsubscribeFn } from "./types"; /** * Similar to constructing a subscription to a value using `useClearedMemo`, but this also allows for making * sure that the most recently notified value is equal to the current value when constructing the subscription. * This solves the problem that `useClearedMemo` may call the getter function inside an effect. */ export declare function useClearedValueSubscription<T>(initialValue: T, getValue: () => T, onValueDiff: () => void, valueSubscriber: (listener: (value: T) => void) => UnsubscribeFn, deps?: readonly any[]): React.MutableRefObject<T>; export declare type Falsey = void | null | false | undefined; export declare function validateListener(listener: any): void;