Interface ForwardRefRenderFunction<T, P>

The type of the function passed to forwardRef. This is considered different to a normal FunctionComponent because it receives an additional argument,

interface ForwardRefRenderFunction<T, P> {
    defaultProps?: undefined;
    displayName?: string;
    propTypes?: undefined;
    (props, ref): ReactNode;
}

Type Parameters

  • T

    The type of the forwarded ref.

  • P = {}

    The type of the props the component accepts.

  • Parameters

    Returns ReactNode

Properties

defaultProps?: undefined

defaultProps are not supported on render functions passed to forwardRef.

displayName?: string

Used in debugging messages. You might want to set it explicitly if you want to display a different name for debugging purposes.

Will show ForwardRef(${Component.displayName || Component.name}) in devtools by default, but can be given its own specific name.

propTypes?: undefined

propTypes are not supported on render functions passed to forwardRef.