What are props, and can a component change its own props?

React JSX, components and props · Freshers

Model answer

Props are the inputs a parent passes to a component, like function arguments: <Button label="Save" />. Inside, you read them from the props object or destructure them: function Button({ label }).

Props are read-only. A component must not change them. If a value needs to change over time, it belongs in state, either in this component or in a parent.

Learn this topic

React Components and Props Explained with Examples in the course React.js Full Course: Beginner to Advanced.

Sign in to add your own answer.

More questions