react-events-and-state Flashcards
1
Q
What is the purpose of state in React?
A
a data model of values that change over time, this allows us to make changes to the dom
2
Q
How to you pass an event handler to a React element?
A
define it as a prototype method in a class, bind it, then (next to the react element type) specify the event type as a prop, followed by an equals sign, followed by the handler name (of the this object) in a javscript expression