Need to change isClicked
on click like a toggle to !isClicked
. It renders JSX styles for a button click.
My data:
const [isApply, setIsApply] = useState([
{
"0": {
"isClicked": false,
"isExpand": false,
"uni": "NSBM"
}
},
{
"1": {
"isClicked": false,
"isExpand": false,
"uni": "NSBM"
}
},
{
"2": {
"isClicked": false,
"isExpand": false,
"uni": "SLIIT"
}
},
{
"3": {
"isClicked": false,
"isExpand": false,
"uni": "SLIIT ACADEMY"
}
},
{
"4": {
"isClicked": false,
"isExpand": false,
"uni": "NIBM"
}
},
{
"5": {
"isClicked": false,
"isExpand": false,
"uni": "NIBM"
}
}
])
const apply = (e) => {
console.log("clicked button id: ", e.currentTarget.id);
console.log(isApply);
setIsApply(...)
};
Need to change isClicked on click like a toggle(!isClicked). It renders jsx styles for a button click. Because it's a nested object and object keys are generated with button click ID it makes it harder to set the state of isClicked need help