【发布时间】:2018-03-15 15:13:33
【问题描述】:
在我的 typescript/reactjs 应用程序中,我试图像这样传递一个名为 test 的属性,这是 index.tsx 的一部分:
ReactDOM.render(
<Provider store={getStore()}>
<BrowserRouter>
<App test={1} />
</BrowserRouter>
</Provider>,
document.getElementById('content')
);
在我的 app.tsx 中有:
export class App extends React.Component<any,{}>{
constructor(props){
super(props);
}
render(){
..
}
}
当我运行应用程序时出现此错误:
ERROR in ./src/index.tsx
(24,12): error TS2339: Property 'test' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<{}, ComponentState>> & Readonly<{ childr...'.
如何确保此错误已得到解决,或者如何在我的 App 组件上传递属性?
【问题讨论】:
标签: javascript reactjs typescript