Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
function useRef
Re-export
import { useRef } from "https://deno.land/x/fathym_atomic_design_kit@v0.0.106-integration/src/src.deps.ts";

useRef returns a mutable ref object whose .current property is initialized to the passed argument (initialValue). The returned object will persist for the full lifetime of the component.

Note that useRef() is useful for more than the ref attribute. It’s handy for keeping any mutable value around similar to how you’d use instance fields in classes.

Parameters

initialValue: T

the initial value to store in the ref object

Returns

MutableRef<T>

Parameters

initialValue: T | null

Type Parameters

optional
T = undefined

Returns

MutableRef<T | undefined>