JSX元素类型没有任何构造或调用签名

时间:2016-06-07 09:47:29

标签: reactjs typescript react-css-modules

我在左侧使用这个简单的React元素作为右侧页面上的根元素。

如何修复显示的错误?

enter image description here

3 个答案:

答案 0 :(得分:3)

这个hacky类型转换使得错误消失了,虽然我根本不理解它:

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

答案 1 :(得分:1)

怎么样:

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

答案 2 :(得分:0)

React期望来自mainScreenHelper.tsx中导入的App的React.StatelessComponent 这意味着您需要在App

中提供该界面
interface IProps {}
const App : React.StatelessComponent<IProps> = () => (
   <div></div>
);