UNPKG

575 BTypeScriptView Raw
1import * as React from 'react';
2/**
3 * @ignore - internal hook.
4 *
5 * Initializes a ref with the given value and updates it when the value changes.
6 *
7 * @param value Value to store in the ref
8 * @param deps An optional array of dependencies to watch for changes. If not provided, the ref will be updated each time the `value` changes.
9 * @returns A React.RefObject containing the latest value
10 *
11 * API:
12 *
13 * - [useLatest API](https://mui.com/base/api/use-latest/)
14 */
15export default function useLatest<T>(value: T, deps?: React.DependencyList): React.MutableRefObject<T>;