如何在TypeScript中使用React BluePrint组件?

时间:2019-03-09 08:01:10

标签: reactjs typescript blueprint

我正在尝试对tsx文件使用React和蓝图

@BatchSize

该文件名为App.tsx。它引发错误为:

  

JSX元素类不支持属性,因为它没有'props'属性。ts(2607)   (别名)类Button   导入按钮

此代码有什么问题?

1 个答案:

答案 0 :(得分:0)

您应该从def func(x): s = set(x) s.discard(0) return len(s) df['uniq'] = df.apply(lambda x: func(x), axis=1) 定义一个propsstate(您可以简单地传递{})

App

使用export class App extends React.Component<{}, {}> { }

或者您想定义<App />

props

使用export class App extends React.Component<{ name: string, age: number }, {}> { }
注意这些是对象类型而不是值。 告诉thar App可以使用<App name="Join" age="22" />

来接收道具