MCPcopy
hub / github.com/primer/react / useProvidedRefOrCreate

Function useProvidedRefOrCreate

packages/react/src/hooks/useProvidedRefOrCreate.ts:11–14  ·  view source on GitHub ↗
(providedRef?: React.RefObject<TRef>)

Source from the content-addressed store, hash-verified

9 * @type TRef The type of the RefObject which should be created.
10 */
11export function useProvidedRefOrCreate<TRef>(providedRef?: React.RefObject<TRef>): React.RefObject<TRef> {
12 const createdRef = React.useRef<TRef>(null)
13 return providedRef ?? createdRef
14}

Callers 15

SelectPanelFunction · 0.90
Tooltip.tsxFile · 0.90
PanelFunction · 0.90
ButtonsFunction · 0.90
List.tsxFile · 0.90
Checkbox.tsxFile · 0.90
FilteredActionListFunction · 0.90
TextInput.tsxFile · 0.90
useMnemonicsFunction · 0.90
useFocusTrapFunction · 0.90
useAnchoredPositionFunction · 0.90
useFocusZoneFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected