MCPcopy Index your code
hub / github.com/ampproject/amphtml / useValueRef

Function useValueRef

src/preact/component/value-ref.ts:6–10  ·  view source on GitHub ↗
(latest: T)

Source from the content-addressed store, hash-verified

4 * Returns a ref that always references the latest value
5 */
6export function useValueRef<T>(latest: T): {current: T} {
7 const valueRef = useRef<T>(latest);
8 valueRef.current = latest;
9 return valueRef;
10}

Callers 15

component.jsFile · 0.90
BentoVimeoWithRefFunction · 0.90
BentoBrightcoveWithRefFunction · 0.90
BentoLightboxWithRefFunction · 0.90
BentoInstagramWithRefFunction · 0.90
BentoAutocompleteFunction · 0.90
component.jsFile · 0.90
component.jsFile · 0.90
BentoSoundcloudFunction · 0.90
IframeEmbedWithRefFunction · 0.90
useQueryFunction · 0.90
useInfiniteQueryFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected