How to register custom events for ordinary dom tags in React

if the title is feasible in vue (pay special attention to native tags rather than custom components)

clipboard.png
syl

clipboard.png

chrome

clipboard.png


react

clipboard.png

clipboard.png

how do I tag normal dom in React register Custom event

Mar.06,2021
The tag component in

React inherits the attributes of the html tag. If the html tag has no attributes, it is automatically ignored.
you can be flexible and replace it with existing events instead of copying vue . This is not written in


React. The DOM element props in


React is bound to ReactDOM's SyntheticEvents, so custom events cannot be listened to. You can bind and unbind manually in ref in componentDidMount and componentWillUnmount .

Menu