Object Destructuring & Spread Operators
This lesson teaches the concepts of Object Destructuring and Spread Operators and how we can use them in React.
What is Destructuring?
Another language feature introduced in JavaScript is called Object Destructuring. It’s often the case that you have to access plenty of properties from your state or props in your component. Rather than assigning them to a variable one by one, you can use destructuring assignment in JavaScript. See the following example for better understanding:
Assume there is an object named student
and you want to extract its properties, one way to do this is:
Get hands-on with 1200+ tech skills courses.