Conteúdo do Curso
Introduction to React
Introduction to React
ES6 Destructuring
The older method of accessing and assigning values from an array was indexing:
However, ES6 has introduced a new method called destructuring, which enables us to access and assign values from an array easily:
The above method is much neater and requires less code.
We can also skip the elements we don't want to capture, for example, we can skip airVehicle
but add an extra comma:
Note
The
const
keyword is for defining constant terms, you can also use thelet
keyword in the Destructuring statement.
Obrigado pelo seu feedback!