在 typeScript中, 您应该安装@ types / react,并在扩展React.Component
时需要指定props
andstate
类型。这是例子
import * as React from 'react'
interface Props {
... // your props validation
}
interface State {
... // state types
}
class FormExample extends React.Component<Props, State> {... }