AceDevHub
Beginner React Interview QuestionsBeginnerConcept

React · Question 9

What is the children prop in React?

Direct answer

The children prop contains the JSX nested inside a component's opening and closing tags, enabling flexible component composition.

Card.jsx
function Card({ children }) {
  return <section className="card">{children}</section>;
}

export default function Page() {
  return (
    <Card>
      <h2>Account</h2>
      <button>Save</button>
    </Card>
  );
}

The Card component does not need to know which exact child elements it wraps. This makes wrapper and layout components highly reusable.