React: Day 3

react-30-day-challenge

Destructuring and Spread operator

Destructuring:

A quick way to assign array items to any variable. For example,

arr = ['banana', 'apple', 'kiwi'] (old way)
first = arr[0]
second = arr[1] third = arr[2]

destructuring features allow you to assign array items easily as, (new way)
var [first, second, third] = arr

Spread operator:

To copy all elements of an array we can use the spread operator. for eg.
arr = [1, 2, 3, 4, 5]
new_arr = [ ..arr ]