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

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

I wrote some code:

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


        
相关标签:
13条回答
  • 2020-11-28 02:58

    When I'm converting from JSX to TSX and we keep some libraries as js/jsx and convert others to ts/tsx I almost always forget to change the js/jsx import statements in the TSX\TS files from

    import * as ComponentName from "ComponentName";

    to

    import ComponentName from "ComponentName";

    If calling an old JSX (React.createClass) style component from TSX, then use

    var ComponentName = require("ComponentName")

    0 讨论(0)
提交回复
热议问题