Function useRef

  • A hook that lets you reference a value that’s not needed for rendering.

    Type Parameters

    • Type

    Parameters

    • initialValue: null | Type = null

      The value you want the ref object’s current property to be initially. It can be a value of any type. This argument is ignored after the initial render.

    Returns RefObject<Type | null>

    • Returns an object with a single property current (initially set to the initialValue you have passed).