Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
handleClick = i => {
this.setState(prevState => {
// const clicked = [...prevState.clicked]; // <- if clicked is declared as an array
const clicked = { ...prevState.clicked };
console.log(`prevState.clicked, clicked`, prevState.clicked, clicked);
clicked[i] = !clicked[i];
return { clicked };
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.