# Type alias ElementRef<C>

ElementRef<C>: "ref" extends keyof ComponentPropsWithRef<C>
? NonNullable<ComponentPropsWithRef<C>["ref"]> extends RefAttributes<infer Instance>["ref"]
? Instance
: never
: never

Retrieves the type of the 'ref' prop for a given component type or tag name.

#### Type Parameters

- C extends ForwardRefExoticComponent<any> | (new (props) => Component<any, {}, any>) | ((props, deprecatedLegacyContext?) => ReactNode) | keyof IntrinsicElements

  The component type.

#### Example

    type MyComponentRef = React.ElementRef<typeof MyComponent>;

#### Example

    type DivRef = React.ElementRef<'div'>;

- Defined in common/temp/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index.d.ts:221