in React JS by

What is the difference between HTML and React event handling?

► Click here to show 2 Answers

0 votes

In HTML, the event name should be in lowercase and you can return false to prevent default behavior

And in React it follows camelCase convention and you must call preventDefault() explicitly

0 votes
Below are some of the main differences between HTML and React event handling,

In HTML, the event name should be in lowercase:

<button onclick='activateLasers()'>

Whereas in React it follows camelCase convention:

<button onClick={activateLasers}>

In HTML, you can return false to prevent default behavior:

<a href='#' onclick='console.log("The link was clicked."); return false;' />

Whereas in React you must call preventDefault() explicitly:

function handleClick(event) {


  console.log('The link was clicked.')


In HTML, you need to invoke the function by appending () Whereas in react you should not append () with the function name. (refer "activateLasers" function in the first point for example)
React JS
Learn More with Madanswer

Related questions

0 votes
asked Jul 2, 2019 in React JS by Venkatshastri