The React docs specifies three "composition events".
onCompositionEnd onCompositionStart onCompositionUpdate
https://facebook.github.io/react/docs/events.html#composition-events
What does composition imply and when do these events occur?
The DOM CompositionEvent represents events that occur due to the user indirectly entering text. It is not React's own event.
Composition Events provide a means for inputing text in a supplementary or alternate manner than by Keyboard Events, in order to allow the use of characters that might not be commonly available on keyboard.
Benefits of using synthetic events:Cross browsers applications are easy to implement. Synthetic events are that ReactJS reuses these events objects, by pooling them, which increase the performance.
Those events would fire when you type non-latin characters like Japanese with IME input to "compose" a word with one or more than two letters. I made a simple demo gif below, please take a look to get a better idea. demo of when CompositionEvent occurs
The DOM CompositionEvent represents events that occur due to the user indirectly entering text. It is not React's own event.
More info: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With