Skip to content
Enact

ui/ForwardRef

A higher-order component interface for ref forwarding.

A higher-order component that adapts https://reacthttps://react.dev/reference/react/forwardRef to be chainable with other HOCs.

The following examples are equivalent:

import ForwardRef from '@enact/ui/ForwardRef';
import Component from './Component';

React.forwardRef((props, ref) => (
	<Component {...props} setMyRef={ref} />
));
ForwardRef({prop: 'setMyRef'}, Component);

Configuration

The prop name to pass the ref callback

Default: 'forwardRef'