Stop abusing `onClick` in React

ยท 1 min read

Abuse examples:

  • onClick on div, span and other non-interactible HTML elements
    • Why not? breaks keyboard accessibility and screen readers
  • buttons with onClicks that navigate you to a new page
    • Why not? breaks keyboard accessibility, right click menu, link preview in bottom left, Cmd+click to open in new tab, and screen readers