import { useId, ComponentType } from 'react'; type ChildProps = Props & { id?: string; }; export type WithIdProps = Props & { id: string; }; /** * @internal * @param {ReactNode} WrappedComponent */ export default function withId( WrappedComponent: ComponentType>, ) { function WithIdComponent(props: ChildProps) { const id = useId(); return ; } WithIdComponent.displayName = `withId(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`; return WithIdComponent; }