Props

Props (short for properties) are the inputs you pass into a React component, like attributes on an HTML tag. They let a parent component send data down to a child, and they are read-only inside the child.

React

You pass props by adding attributes when you use a component, such as <User name="Ana" age={30} />. Inside the component, those values arrive together as a single object (conventionally called props), so you read them as props.name and props.age.

Props flow one way: from parent to child. A component must never modify its own props — they are read-only. To change what a component displays in response to interaction, you use state instead.

Examples

JSX — Destructures props directly in the parameter list; renders a paragraph reading 'Likes: 42'.

function Card({ title, count }) {
  return <p>{title}: {count}</p>;
}

function App() {
  return <Card title="Likes" count={42} />;
}

Learn it in a lesson

See also

Back to the Dictionary