Skip to content

Instantly share code, notes, and snippets.

@dance2die
Last active August 25, 2018 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dance2die/9735e8714ab1796f41ec30dea6a2ea81 to your computer and use it in GitHub Desktop.
Save dance2die/9735e8714ab1796f41ec30dea6a2ea81 to your computer and use it in GitHub Desktop.
onClick = e => {
e.persist();
const clickCounts = { ...this.state.clickCounts };
let clickCount = +clickCounts[e.target.name] || 0;
clickCounts[e.target.name] = ++clickCount;
this.setState({ clickCounts };
setTimeout(() => {
console.log(
`Button Name (⏳ setTimeout) = ${e.target.name}`,
this.state.clickCounts
);
}, 100);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment