React Questions Flashcards
Difference between state and props
Both used to pass data but state is mutable but managed within a component; props are immutable and can be passed between components
How does react handle forms, what are controlled components?
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
Significance of keys in react lists
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
Purpose of use effect
Handle side effects in functional components allowing you to perform actions such as data fetching or subscriptions after the component renders