React-Events Flashcards

1
Q

What is an “event” in React?

A

events are usually user interactions with a web app that trigger a change to the web app

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is an “event handler”? Which component declares the handler?

A

They are custom functions that are called in response to user interactions on the web app. The parent component declares event handlers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you pass an event handler to a React component?

A

First you have to define the event handler function then pass it as a prop to the jsx element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the naming convention for event handlers?

A

Usually it will named with the word handle followed by the event type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an “event handler prop”? Which component declares the prop?

A

An event handler prop is a prop that is passed an event handler from a different component usually from it’s parent component. The child component declares the prop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are some custom event handler props a component may wish to define?

A

the onClick event handler prop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the naming convention for custom event handler props?

A

based on app-specific interactions i.e onPlayMovie, onUploadImage

How well did you know this?
1
Not at all
2
3
4
5
Perfectly