- The map() function is used to iterate over an array and manipulate or change data items. In React, the map() function is most commonly used for rendering a list of data to the DOM Each time the callback executes, the returned value is then added to a new array.
- A “key” is a special string attribute you need to include when creating lists of elements in React. Keys are used to React to identify which items in the list are changed, updated, or deleted. In other words, we can say that keys are used to give an identity to the elements in the lists.
- he Spread operator lets you expand an iterable like an object, string, or array into its elements while the Rest operator does the inverse by reducing a set of elements into one array.
- copping array
- merge two object -compine two array
-
const arr1 = [1,2,3]
-
const arr2 = [4,5,6]
-
const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6]
-
const a = ['to', 'code'];
-
const b = ['learning', ...a, 'is', 'fun'];
-
console.log(b); //> ['learning', 'to', 'code', 'is', 'fun']