Props vs State
Props are the inputs a part gets from the part above it, and it should not change them. State is data a part owns and can change, and the screen follows it.
Props
The inputs a component gets from the part that holds it.
Props are the inputs a parent component passes to a child component. They let one component show different things in different places, like a different name or price. A child reads its props but should not change them. If something needs to change, the parent changes the value and passes it down again. The name is short for properties.
UI State
The data a page holds right now that can change, like a count.
State is the data a page holds right now that can change. A count, a typed word or an open menu are all state. When the state changes, the framework draws the affected parts of the page again. You do not change the screen by hand; you change the state, and the screen follows. State can live in one component or be shared across the whole app. Keeping it small and in one place makes bugs rarer.
In one line
- Props
- The inputs a component gets from the part that holds it.
- UI State
- The data a page holds right now that can change, like a count.