jeudi 28 juin 2018

How Add or Remove Checkboxes value from the array?

i want to add or remove value from the array. when i select the checkbox the value will pushed to array. when i unselect the checkbox the value will remove from the array.

CheckBox

<CheckBox
 checked={this.state.currentValue}
onClick={() => this._changeValue(index)}>

onClick function

_changeValue(value) {
    this.setState({
      currentValue: !this.state.currentValue,
    });
   console.log(value)
   selectedQuesiton.push(value)
  }



Aucun commentaire:

Enregistrer un commentaire