UNPKG

rc-hooks

Version:
13 lines (12 loc) 413 B
/** * 返回最新的 state 或 props 。 * * @param value state 或 props 的值。 * @returns * @example * const [count, setCount] = React.useState(0); * // 最新的 count 值。可以在其他 hook 中使用,而不需要依赖它触发更新。 * const latestCount = useLatest(count); */ declare function useLatest<T = any>(value: T): import("react").MutableRefObject<T>; export default useLatest;