dimanche 23 avril 2017

Push checked value of checkbox and pop unchecked value in reactjs

Sorry if this is a very silly question but I am stuck and unable to find any solution.

I am generating checkboxes dynamically using map function and I want to push some value when the checkbox is checked and pop that value if checkbox is unchecked.

this.state.invoices.map((inv,i)=>{
   <input type="checkbox" id="checkbox" checked=??? className="floatright" onClick={()=>{this.childCheckfunc(inv)}}/>

I am getting some value in childCheckfunc() and i want to know how do i manage checked property of checkbox to get the checked value so that i can push it in an array and pop if unchecked.

Thank you so much :)




Aucun commentaire:

Enregistrer un commentaire