How to get multiple checkbox values to an array in react js? This is my dynamic destination places from API. I want post to Backend with an array.
{
this.state.destination.length > 0 ? (
this.state.destination.map((destination, index) => (
<div className="col-md-3">
<div class="pretty p-default">
<input type="checkbox" name="dest" value={index} onClick={event => this.handleDestination(event)} />
<div class="state p-primary">
<label>{destination.dest_name}</label>
</div>
</div>
</div>
))
) : (
<div>
<label>
<b>No results found ! </b>{' '}
</label>
</div>
);
}
handleDestination(event) {
const options=this.state.options
let index
if(event.target.checked){
options.push(+event.target.value)
}
else{
index=options.indexOf(+event.target.value)
options.splice(index,1)
}
this.setState({ options:options})
}