我不熟悉 React,希望能得到一些帮助。我在表格中有一个表格,其中每一行都是一个具有状态(“待批准”或“已批准”)的项目。我在每一行也有一个复选框。I would like it so that when the checkbox next to a row is selected and the form is submitted, I can change the status of each selected project to 'Approved.'
<Form>
<FormGroup>
<Button type="submit" onClick {this.submitClicked}>Approve Projects</Button>
</FormGroup>
<Table bordered={true}>
<thead>
<tr>
<th>Select</th>
<th>Project Name</th>
<th>Project Number</th>
<th>Project Status</th>
<th>Min Size</th>
<th>Max Size</th>
</tr>
</thead>
<tbody>
{projects.map((project: Project) =>
<tr key={project.projectNumber}>
<td>
<FormControl
type="checkbox"
id="selected"
value={project.projectName}
onChange={e => this.handleChange(e)}
/>
</td>
<td>{project.projectName}</td>
<td>{project.projectNumber}</td>
<td>{project.status}</td>
<td>{project.minSize}</td>
<td>{project.maxSize}</td>
</tr>
)}
</tbody>
</Table>
</Form>
我的 handleChange 函数应该包含什么,我应该如何去做?我想知道是否有某种方法可以将选定的项目添加到数组中,然后更改它们的状态值?