1.What is the difference between state and props in React?
Warm-upWhat a strong answer covers
- Props are inputs passed down from a parent and are read-only within the receiving component; state is data a component owns and can update over time.
- Updating state (via the setter from useState) schedules a re-render; you never mutate props or state directly.
- Data flows one way: parent to child via props, and children communicate up by calling callback props the parent passed down.
- A strong answer notes that lifting state up to a common ancestor is how sibling components share data.
Where people lose the point
- Saying you can change props from inside the component, or mutating this.props / a prop object.
- Mutating state directly (e.g. state.push(x)) instead of producing a new value through the setter.
- Confusing which one triggers a re-render, or claiming props changes never cause re-renders.