Skip to content

Instantly share code, notes, and snippets.

@Mohammad-Faisal
Created April 23, 2021 09:54
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