dimanche 11 février 2018

React Semantic UI Checkbox get key value

I am currently developing a React website using the semantic UI CSS React framework. In this regard, I am fetching data from Firebase in to a table view so the user can see. Along with this, I have a field where the user can check each row, and delete the specific data. However, I am struggling with getting the specific Checkbox key from my 'handleChange' method. This is my code so far:

handleChange = (e) => {
    console.log('it works');
    console.log(e.target.key);
}

And this is my code for the Checkbox display:

<Table.Cell><Checkbox key={singleNews.key} name="myCheckBox1" onChange={this.handleChange}/></Table.Cell>

The console outputs 'it works', but on the other line it just says 'undefined'. How is this possible?

Could someone please help me with this?




Aucun commentaire:

Enregistrer un commentaire