Handling Events
Handling events with React elements is very similar to handling events on DOM elements.
- React events are named using camelCase, rather than lowercase.
- With JSX you pass a function as the event handler, rather than a string.
- Another difference is that you cannot return false to prevent default behavior in React. You must call preventDefault explicitly.
- When using React, you generally don’t need to call addEventListener to add listeners to a DOM element after it is created.
- When you define a component using an ES6 class, a common pattern is for an event handler to be a method on the class.