react-events-and-state Flashcards

1
Q

What is the purpose of state in React?

A

it controls what’s diplay ont eh page and update based on different situations.

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

How to you pass an event handler to a React element?

A
you would add a react event listener to the element and pass a function as a event handler.
ex:     
button onClick={this.sayHello}
      Click me!
/button
(sayHello is the event handler)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly