JSX element type does not have any construct or call signatures

醉酒当歌 提交于 2019-12-10 12:29:12

问题


I'm using this simple React element on the left as my root element on the page in the right.

How do I fix the error shown?


回答1:


This hacky typecast makes the error go away, though I don't understand it at all:

const App: any = require('./components/views/app/app');




回答2:


How about:

class App extends React.Component<any, any> {
    render() {
        return <div>foo</div>;
    }
}



回答3:


React expects a React.StatelessComponent from the imported App in mainScreenHelper.tsx This means that you need to provide that interface in App

interface IProps {}
const App : React.StatelessComponent<IProps> = () => (
   <div></div>
);


来源:https://stackoverflow.com/questions/37675920/jsx-element-type-does-not-have-any-construct-or-call-signatures

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!