@mui/base
Version:
A library of headless ('unstyled') React UI components and low-level hooks.
16 lines (15 loc) • 575 B
TypeScript
import * as React from 'react';
/**
* @ignore - internal hook.
*
* Initializes a ref with the given value and updates it when the value changes.
*
* @param value Value to store in the ref
* @param deps An optional array of dependencies to watch for changes. If not provided, the ref will be updated each time the `value` changes.
* @returns A React.RefObject containing the latest value
*
* API:
*
* - [useLatest API](https://mui.com/base/api/use-latest/)
*/
export default function useLatest<T>(value: T, deps?: React.DependencyList): React.MutableRefObject<T>;