A hook that returns the latest value, that could avoid the closure problem.
const latestValueRef = useLatest<T>(value: T): MutableRefObject<T>;
const latestValueRef = useLatest<T>(value: T): MutableRefObject<T>;
Basic usage of useLatest hook.
Property | Description | Type | Default |
---|---|---|---|
- | - | - |