Moezalez Moezalez - 2 months ago 12
React JSX Question

How to flow type a Component?

type Props = {
Component: ???
}
const AnotherComp = ({Component}: Props) => (
<Component />
)


What's the proper way to add a prop for the component?

Answer

The type that you're looking for is called ReactClass. The type for any component would be ReactClass<any>.

Check out this similar question: What type to use for things React can render?

Comments