mardi 8 octobre 2019

Handle on change for checkbox

I have a state witch is false by default. When the checkboxe is check i want the state to become true.

state = {
    status: false,
}

handleChange = (event) => {
    this.setState({
      [event.target.id]: event.target.value
    });
}


 <Form.Check
    type="checkbox" 
    label="Consigne temporaire"
    value={this.state.status}
    onChange={this.handleChange} />

The state doesn't change when i click on the checkbok. It always false




Aucun commentaire:

Enregistrer un commentaire