Skip to content
IT glossary
FrontendUpdated December 3, 2026

Props

Props are named inputs that a parent component passes to a child. They let you reuse the same component with different content, settings, or responses to user actions.

Also known as: пропсы

What props are

Props, short for properties, are how you configure a component where you use it. A product card might accept a name and a price rather than hard-code either one. You can then use the same card for dozens of products. The props a component accepts are part of its public interface: callers need to know what to supply, not how the card builds its markup.

How props work in React

In JSX, custom component props look like attributes: <ProductCard name="Tea" price={250} />. Quoted text is a string; braces evaluate a JavaScript expression, so price={250} passes a number. You can also pass objects, arrays, and functions. A function component receives a props object as its first argument and can use destructuring to read individual values. JSX nested between a component's opening and closing tags is passed as children.

Props travel down the component tree. A child can ask for a change by calling a function it received as a prop. That function can update the owner's state, and React can then render the child with the resulting values. Calling the function doesn't change the props of the current render.

Example: a follow button

import { useState } from 'react';

function FollowButton({ following, onToggle }) {
  return (
    <button type="button" onClick={onToggle}>
      {following ? 'Unfollow' : 'Follow'}
    </button>
  );
}

function Profile() {
  const [following, setFollowing] = useState(false);
  return (
    <FollowButton
      following={following}
      onToggle={() => setFollowing(current => !current)}
    />
  );
}

Profile owns the follow state. FollowButton uses following to choose a label and calls onToggle when clicked. The same value is state in Profile and a prop in FollowButton. Another part of the profile can read that same state without keeping a separate copy.

Common mistakes

  • Copying a prop into state to keep it in sync. useState(prop) uses the prop as the initial value; later prop changes don't automatically update that state. Read the prop directly unless you deliberately want a separate value, such as an editable draft.
  • Mutating an object passed as a prop. Treat props and their contents as read-only. A mutation can affect other components using the same object and doesn't tell React to render an update. Have the owner create and pass an updated object instead.
  • Expecting every JSX attribute to reach the child or the DOM. React consumes key itself, so the child can't read it from its props. Pass an ID separately if you need one. A custom prop such as following also won't appear on the DOM button unless the component explicitly passes it through.

What interviewers ask

A common exercise is to make two sibling components share a selection. Put the selection in their nearest common parent, pass the current value to both, and give the component that can change it a callback. A follow-up may ask about prop drilling: passing a value through several components that don't use it themselves. A short chain is often fine because the dependencies are visible. Context is worth considering when many components across a subtree need the same value.