There's more...

There are more events you can use in React:

Keyboard events:

  • onKeyDown is executed when a key is depressed
  • onKeyPress is executed after the key is released, but before onKeyUp is triggered
  • onKeyUp is executed last after the key is pressed

Focus events:

  • onFocus is executed when a control receives focus
  • onBlur is executed when a control loses focus

Forms events:

  • onChange is executed when the user changes the value in a form control
  • onSubmit is a particular prop for <form> that is called when a button is pressed, or when the user hits the return key within a field

Mouse events:

  • onClick is when the mouse button is pressed and released
  • onContextMenu is when the right button is pressed
  • onDoubleClick is when the user performs ...

Get React Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.