UNPKG

@uiw/react-native

Version:
24 lines (23 loc) 747 B
/// <reference types="react" /> /** * 获取上一轮的 props 或 state * How to get the previous props or state? * https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state * @example * ```js * function Counter() { * const [count, setCount] = useState(0); * const prevCount = usePrevious(count); * return <h1>Now: {count}, before: {prevCount}</h1>; * } * ``` */ export declare function usePrevious<T>(value: T): T | undefined; type Options<T> = { value?: T; defaultValue: T; onChange?: (v: T) => void; }; export declare function usePropsValue<T>(options: Options<T>): readonly [T, (v: T) => void]; export declare function useLatest<T>(value: T): import("react").MutableRefObject<T>; export {};