Leo*_*all 0 types typescript reactjs
我有一个处理不断变化的文本字段的函数:
private handleNameChange(e: React.FormEvent<FormControl>) {
const name = e.target.value;
this.setState({ name });
this.props.editGroupName(name);
}
Run Code Online (Sandbox Code Playgroud)
这连接到 FormControl 的 onChange:
<FormControl type='text' placeholder='Name' value={this.state.name} onChange={this.handleNameChange} />
Run Code Online (Sandbox Code Playgroud)
然而,根据 TypeScript 的说法,这是错误的:
TS2339: Property 'value' does not exist on type 'EventTarget'.
Run Code Online (Sandbox Code Playgroud)
我也尝试过使用currentTarget. 我怎么解决这个问题?
| 归档时间: |
|
| 查看次数: |
1334 次 |
| 最近记录: |