I have a React component that is, more or less, a simple textarea where a user can type into. Here is what the code looks like so far:
import React from \'r
You can use both of handlers same time.
In onKeyDown you can check key. If it is ENTER pressed call event.preventDefault()
to prevent onChange
call, or if it is not - do nothing
Javascript event queue doesn't contain change
event until default handler for keydown
event is called. If you call event.preventDefault()
in onKeyDown
handler no change
event will be fired.