Closed davepwsmith closed 3 years ago
I suspect that what is actually wanted here is React.ElementType
? This would allow to render as all components, and also as basic intrinsic HTML types such as and
@davepwsmith Yes please open the PR =)
Thanks
Having the type as seems to have a dual effect of expecting multiple children, and also preventing other typed components being used for renderAs.
Changing
export type RenderAsComponent = string | React.ComponentType<never>
toexport type RenderAsComponent = string | React.ComponentType
orexport type RenderAsComponent = string | React.ComponentType<any>
Both seem to fix the problem, but not sure what the side effects would be.
Are you looking to explicitly prevent people from using other components in renderAs? Because that will basically prevent people from using this with Gatsby I think?