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
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 });
}