MCPcopy
hub / github.com/visgl/react-google-maps / useCallbackRef

Function useCallbackRef

src/hooks/use-callback-ref.ts:3–8  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import {Ref, useCallback, useState} from 'react';
2
3export function useCallbackRef<T>() {
4 const [el, setEl] = useState<T | null>(null);
5 const ref = useCallback((value: T) => setEl(value), [setEl]);
6
7 return [el, ref as Ref<T>] as const;
8}

Callers 2

useMap3DInstanceFunction · 0.90
useMapInstanceFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected