ksloan
ksloan

Reputation: 1492

Using react.js with custom native DOM events

How do you access native dom events with react?

The documentation says "If you find that you need the underlying browser event for some reason, simply use the nativeEvent attribute to get it.

How do you use the nativeEvent attribute?

I tried onDelete={this.handleDelete} but it doesn't seem to get triggered. I can bind the event with jQuery so I know it's firing.

Upvotes: 1

Views: 1000

Answers (1)

Brigand
Brigand

Reputation: 86260

React doesn't support custom DOM events. You have two options:

Either of these should be wrapped into a mixin, and don't forget to remove the listeners in componentWillUnmount. The jQuery option is a last resort.

Upvotes: 1

Related Questions