i have multiple checkboxes i want to store the id, currentdate, and boolen value
of check box
of all the check boxes that are getting cliked
<div className="accordion-content tableforsymtm">
{this.state.custum.map((personData, key) => {
return (
<span className="trforsymtm">
<td key={personData.id}>
<input
data-id={personData.id}
type="checkbox"
checked={personData && personData.positive}
onChange={(e) =>
this.custumhandleCheckClick(
e,
"custum",
key
)
}
/>
</td>
<td className="tdoneline">
{personData.symptom}
</td>
</span>
);
})}
</div>
I want to store data like below in state
I want to store it like this because I want to pass the data to API only when I click on a submit button
[
{
"date" : "2022-02-15",
"id" : 6,
"boolvalue" : true
},
{
"date" : "2022-02-15",
"id" : 5,
"boolvalue" : false
},
{
"date" : "2022-02-15",
"id" :7,
"boolvalue" : true
},
{
"date" : "2022-02-15",
"id" : 11,
"boolvalue" : true
},
{
"date" : "2022-02-15",
"id" : 4,
"boolvalue" : false
}
]