Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

React.ComponentProps

function myFunction<T extends React.ComponentType<any>>
  (Component: T, props: React.ComponentProps<T> {
  // implementation
}

// You must extend the T otherwise you will get this error
// Type 'T' does not satisfy the constraint 'keyof IntrinsicElements | JSXElementConstructor<any>'.
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
8+7 =