Skip to main content

useRef

function

`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.

function useRef<T>(initialValue: T): RefObject<T> function useRef<T>(initialValue: T | null): RefObject<T | null> function useRef<T>(initialValue: T | undefined): RefObject<T | undefined>

Import

import { useRef } from '@modular/sdk/editor';

Notes

version
16.8.0
see
{@link https://react.dev/reference/react/useRef}
version
16.8.0
see
{@link https://react.dev/reference/react/useRef}
version
16.8.0
see
{@link https://react.dev/reference/react/useRef}