0% found this document useful (0 votes)
4 views

Events in ReactJS

Uploaded by

eonly6080
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Events in ReactJS

Uploaded by

eonly6080
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

MOST COMMON

REACTJS
INTERVIEW QUESTIONS
What is an Event in React?

SlobodanGajić
SWIPE
What is an Event in React?

Events are the triggered reactions to specific


actions like mouse click, mouse hover, key stroke,
etc.

Handling these events are similar to handling


events in DOM elements.

But there are some syntactical differences like:

SWIPE
Events are named using camel case instead of just
using the lowercase.
Events are passed as functions instead of strings

SWIPE
Another difference is that you cannot return false to
prevent default behavior in React.

You must call preventDefault explicitly.

For example, with plain HTML, to prevent the default


form behavior of submitting, you can write:

SWIPE
In React, this could instead be like this. Here, e is a
synthetic event.

React defines these synthetic events


so you don’t need to worry about
cross-browser compatibility.

SWIPE
Did you learned
anything new??
LET ME KNOW IN THE COMMENTS

SlobodanGajić SlobodanGajic

You might also like