State & useState
Give components memory so they can react to user interactions.
is the memory of a . It lets the UI remember things: what the user typed, whether a menu is open, the current score.
When state changes, React re-renders the component with the new value, keeping the UI in sync with the data.
The `` hook is how a component gets a state variable: you give it an initial value, and it gives you back the value plus a function to update it.
Diagram
Grounded on https://react.dev/learn/state-a-components-memory