'What is the "React" of React.MouseEvent<HTMLInputElement>?
type Props = {
onClick: (event: React.MouseEvent<HTMLInputElement>) => void
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void
onkeypress: (event: React.KeyboardEvent<HTMLInputElement>) => void
onBlur: (event: React.FocusEvent<HTMLInputElement>) => void
onFocus: (event: React.FocusEvent<HTMLInputElement>) => void
onSubmit: (event: React.FormEvent<HTMLFormElement>) => void
onClickDiv: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void
}
What is this? and why is the need?
Is this only available for the React app?
Solution 1:[1]
This is so-called SyntheticEvents. Here it is nice explanation. But shortly answering your question:
- They are inherited events from basic HTML elements.
- It is needed for cross browser-browser accessibility and manipulation with virtual DOM
- All top frameworks support their own implementation
And of course you could always read React Documentation.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Aaron Vasilev |
