🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to React Notes
Topic #24

React Props Destructuring


Destructuring Props

You can limit the properties a component receives by using destructuring.

Example

function Car({color}) {
  return (
    <h2>My car is {color}!</h2>
  );
}

createRoot(document.getElementById('root')).render(
  <Car brand="Ford" model="Mustang" color="red" year={1969} />
);

Note: React uses curly brackets to destructure props: {color}.


You can also destruct the properties you need inside the component.

This way, the component receives all the properties, but the destructuring makes sure it only uses the ones it needs.

Example

function Car(props) {
  const {brand, model} = props;
  return (
    <h2>I love my {brand} {model}!</h2>
  );
}

createRoot(document.getElementById('root')).render(
  <Car brand="Ford" model="Mustang" color="red" year={1969} />
);

Destructuring ...rest

When you don't know how many properties you will receive, you can use the ...rest operator.

Meaning: you can specify the properties you need, and the rest will be stored in an object.

Example

function Car({color, brand, ...rest}) {
  return (
    <h2>My {brand} {rest.model} is {color}!</h2>
  );
}

createRoot(document.getElementById('root')).render(
  <Car brand="Ford" model="Mustang" color="red" year={1969} />
);

Default Values

With Destructuring, you can set default values for props.

If a property has no value, the default value will be used.

Example

function Car({color = "blue", brand}) {
  return (
    <h2>My {color} {brand}!</h2>
  );
}

createRoot(document.getElementById('root')).render(
  <Car brand="Ford" />
);

Want to go beyond the notes?

Join CodingNow 2.0's React course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

React Props Destructuring – FAQs

Quick answers about learning React Props Destructuring in React.

This free note from CodingNow 2.0 explains React Props Destructuring in React — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every React topic on CodingNow 2.0, including React Props Destructuring, is 100% free with no signup required.
With focused practice, most students grasp React Props Destructuring in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now