Languages
[Edit]
EN

React - Keyboard Events

0 points
Created by:
Elias999
819

In this article, we would like to show you keyboard events in React.

There are three keyboard events:

  • onKeyUp
  • onKeyDown
  • onKeyPress

In the following example, we create functions that handle onKeyUp and onKeyDown events and display to the console which action was performed.

Note:

onKeyPress event is no longer recommended, so avoid using it. 

Runnable example:

See also

Edit
  1. React - onKeyDown event handler

References

Edit
  1. keyup event (js) - MDN Docs

  2. keydown event (js)- MDN Docs

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

ReactJS - events

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join