Search Docs
A hook that returns the latest value, that could avoid the closure problem.
const latestValueRef = useLatest<T>(value: T): MutableRefObject<T>;
Basic usage of useLatest hook.