Skip to content

Instantly share code, notes, and snippets.

@Mohammad-Faisal
Created April 23, 2021 09:54
Show Gist options
  • Save Mohammad-Faisal/2eda63340eeedcb338e48787fd17235f to your computer and use it in GitHub Desktop.
Save Mohammad-Faisal/2eda63340eeedcb338e48787fd17235f to your computer and use it in GitHub Desktop.
const onClickHandler = (event) => {
console.log(event.target, 'clicked!');
}
return (
<ul>
{posts.map((post) => (
<li onClick={onClickHandler} key={post.id}> {post.title} </li>
))}
</ul>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment