In React, state and props are two core concepts used to manage and pass data in components:
Feature |
|
|
---|---|---|
Mutability | Mutable (can change over time) | Immutable (read-only) |
Scope | Local to the component | Passed from parent to child |
Who sets it? | Set and managed inside the component | Set by the parent component |
Usage | To track UI changes (e.g., user input) | To configure or customize child components |
Updates cause re-render? | ✅ Yes | ✅ Yes |