Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumReactforwardRefSingle-choice MCQ

In a TypeScript design system, a generic list component is wrapped with `forwardRef` so callers can pass a ref. After wrapping, callers can no longer benefit from the component's generic type parameter `T` (it collapses to `unknown`). What is the underlying reason?

const List = forwardRef( function List<T>(props: { items: T[]; render: (x: T) => ReactNode }, ref: Ref<HTMLUListElement>) { return <ul ref={ref}>{props.items.map(props.render)}</ul>; } );