React State & Props Flashcards

1
Q

What is the difference between state and props in React?

A

State is a mutable data structure that holds local component data, while props are read-only and are passed down from parent to child components.

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

How do you pass a function from a parent component to a child component?

A

Through props. e.g., <ChildComponent myFunction={this.myFunction} />.

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