Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save tonkotsuboy/2efc6c6146b327fe5147215edc920cb7 to your computer and use it in GitHub Desktop.

Select an option

Save tonkotsuboy/2efc6c6146b327fe5147215edc920cb7 to your computer and use it in GitHub Desktop.
event.target しか使わない関数の定義方法について思っていること。
// event.targetしか使わない関数
// ちょっと冗長かも🤮
const foo = (event: MouseEvent) => {
if (event.target == null) {
return;
}
console.log(event.target);
};
// すっきり🥰
const bar = ({ target }: MouseEvent) => {
if (target == null) {
return;
}
console.log(target);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment