0% found this document useful (0 votes)
14 views5 pages

17 - de Structuring Props and State

Destructuring allows developers to extract data from arrays and objects and assign them to new variables. This copies the desired data without modifying the original array or object. In destructuring, variables can be assigned directly from array or object elements. This makes code more readable and sustainable by reducing the amount of code needed to access data properties. Destructuring provides components with exactly the data they need in a concise way.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

17 - de Structuring Props and State

Destructuring allows developers to extract data from arrays and objects and assign them to new variables. This copies the desired data without modifying the original array or object. In destructuring, variables can be assigned directly from array or object elements. This makes code more readable and sustainable by reducing the amount of code needed to access data properties. Destructuring provides components with exactly the data they need in a concise way.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

PART-17

DE-STRUCTURING
PROPS AND STATE
REACT
PRESENTER: MOHAMMAD ADIL
What is Destructuring? REACT

• Destructuring is a characteristic of JavaScript, It is used to take out


sections of data from an array or objects, We can assign them to new
own variables created by the developer.
• In destructuring, It does not change an array or any object, it makes a
copy of the desired object or array element by assigning them in its
own new variables, later we can use this new variable in React (class
or functional) components.
Destructing Arrays In JavaScript REACT

• const students = [‘Adil', ‘Kumar', ‘Zain'];

• // old way – Without Destructuring


• const std1 = students[0];
• const std2 = students[1];
• const std3 = students[2];
Destructing Arrays In JavaScript REACT

• const students = [‘Adil', ‘Kumar', ‘Zain'];

• // With Destructuring
• const [std1, std2, std3] = students;
Advantages of Destructuring REACT

• It makes developer’s life easy, by assigning their own variables.


• It improves the sustainability, readability of code.
• It helps to cut the amount of code used in an application.
• It trims the number of steps taken to access data properties.
• It provides components with the exact data properties.
• It saves time from iterate over an array of objects multiple times.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy