react-events-and-state Flashcards
1
Q
What is the purpose of state in React?
A
state is a way to manage and track changes in component data over time. It is an object that holds data specific to a component and can be updated within the component, causing the component to re-render
2
Q
How to you pass an event handler to a React element?
A
you pass it as a prop to the element, just like any other data.