What does the error “JSX element type '…' does not have any construct or call signatures” mean?

后端 未结 13 2257
余生分开走
余生分开走 2020-11-28 02:05

I wrote some code:

function renderGreeting(Elem: React.Component) {
    return Hello, !;
}
         


        
13条回答
  •  清酒与你
    2020-11-28 02:35

    If you are passing functional component as props to anyother component use following:

    import React from 'react';
    
    type RenderGreetingProps = {
      element: React.FunctionComponent
    };
    
    function RenderGreeting(props: RenderGreetingProps) {
      const {element: Element} = props;
    
      return Hello, !;
    }
    

提交回复
热议问题