REACT EVENTS AND STATE Flashcards

1
Q

What is the purpose of state in React?

A

It holds data that represents the current condition of a component
datamodel of values that change over time

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

eventhanlders are methods and need to be binded
this.handleClick = this.handleClick.bind(this);

handleClick() {
this.setState({ isClicked: true });
}

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