react-events-and-state Flashcards
1
Q
What is the purpose of state in React?
A
Keep track of values that change over time.
It’s a serializable* representation of one point in time—a snapshot.
The state starts with a default value when a Component mounts and then suffers from mutations in time (mostly generated from user events)
2
Q
How to you pass an event handler to a React element?
A
As a prop. In event name and camel case (starts with ‘on’)