I have a long list of checkboxes (not that optimised) and I want to get them in a state:Array(the checked one) and I'm not really sure how to handle it hope for help(should also handle uncheck when clicked)...
the question is how do I HandleCheckbox.
this.state = {
checkboxed: [],
}
<div className=' row float-center d-flex justify-content-center '>
<label className='m-3'>
<input name='1' type='checkbox' checked={this.state.isGoing} onChange={this.handleInputChange} />
1
</label>
<label className=' m-3'>
<input name='1.5' type='checkbox' checked={this.state.isGoing} onChange={this.handleInputChange} />
1.5
</label>
<label className=' m-3'>
<input name='2' type='checkbox' checked={this.state.isGoing} onChange={this.handleInputChange} />
2
</label>
<label className=' m-3'>
<input name='2.5' type='checkbox' checked={this.state.isGoing} onChange={this.handleInputChange} />
2.5
</label>
<label className=' m-3'>
<input name='3' type='checkbox' checked={this.state.isGoing} onChange={this.handleInputChange} />
3
</label>
<label className=' m-3'>
<input name='3.5' type='checkbox' checked={this.state.isGoing} onChange={this.handleInputChange} />
3.5
</label>
</div>
Aucun commentaire:
Enregistrer un commentaire