Question

What's the difference between event attribute names in HTML and React?

#react

Answer

In React the synthetic event attribute names are in camelCase...

 <button onClick={activateLasers}>
   Activate Lasers
 </button>

In HTML the attributes for native DOM events are in lowercase...

<button onclick="activateLasers()">
  Activate Lasers
</button>

https://reactjs.org/docs/handling-events.html

Learn

Author

xavi

Reviews
Last
next

Students 1