受控组件:通过更新状态来更改数据 import React from ‘react’ class TodoList extends React.Component { state = { taskA: '', taskB: '', list: [] } render () { return ( <> <div> taskA <input type='text' name='taskA' value={this.state.taskA} onChange={this.handleChange} /><button onClick={this.handleAdd} name='taskA'>添加</button> </div> <div> taskB <input type='text' name='taskB' value={this.state.taskB} onChange={this.handleChange} /><button onClick={this.handleAdd} name='taskB'>添加</button> <div> <ul> this.state.map( (item, index) => <li key={ item + index }>{ item }<button onClick={() => this.handleDelete