Understanding React State
If "Props" are the parameters passed into a component, "State" is the component's internal memory. It holds data that changes over time and affects what is rendered on the screen.
The useState Hook
We manage state using the useState hook. When you call it, you provide the initial state, and it returns an array containing two items: the current value, and a function to update that value.
Triggering Re-Renders
Never mutate your state directly (e.g. user.name = "John"). When you use the setter function provided by React, you are telling React: "Hey, the state changed! Please recalculate the UI."
View Full Transcript+
This section contains the full detailed transcript of the video lessons for accessibility purposes and quick review. It covers the difference between state and props, the destructuring syntax of useState, and the asynchronous nature of state updates in React.
