What is state, and how is it different from props?

React state and events · Freshers

Model answer

State is data that a component owns and that can change over time, such as the text in an input or whether a menu is open. Props are data passed in from a parent and are read-only for the child.

When state changes, React re-renders the component. When a parent re-renders and passes new props, the child re-renders too.

Learn this topic

React useState Explained: Make Your Page React to Change in the course React.js Full Course: Beginner to Advanced.

Sign in to add your own answer.

More questions