React Questions Flashcards

1
Q

Difference between state and props

A

Both used to pass data but state is mutable but managed within a component; props are immutable and can be passed between components

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

How does react handle forms, what are controlled components?

A

React uses controlled components to handle form elements.

Input values controlled by the state of the component which enables react to control and validate user input

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

Significance of keys in react lists

A

Used to identify unique elements in a react list. They help efficiently update UI by minimising re renders.

Keys should be stable and unique and assigned to elements inside a map function

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

Purpose of use effect

A

Handle side effects in functional components allowing you to perform actions such as data fetching or subscriptions after the component renders

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