@uiw/react-native
Version:
UIW for React Native
22 lines (21 loc) • 638 B
TypeScript
/**
* 获取上一轮的 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;
declare 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 {};