MCPcopy
hub / github.com/final-form/react-final-form / useLatest

Function useLatest

src/useLatest.ts:3–11  ·  view source on GitHub ↗
(value: T)

Source from the content-addressed store, hash-verified

1import React from "react";
2
3export default function useLatest<T>(value: T): { readonly current: T } {
4 const ref = React.useRef(value);
5
6 React.useEffect(() => {
7 ref.current = value;
8 });
9
10 return ref;
11}

Callers 1

useFieldFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…