growthmindsit

Passing Functions as Props

1- What does .map() return?

The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.the array will be the same lenght of the origin one .

2- if I want to loop through an array and display each value in JSX, how do I do that in React?

I can do that by using map() array metod .

3- Each list item needs a unique key__. 4- What is the purpose of a key?

Keys are necessary to improve performance of our React app ;Keys help React identify which items have changed (added/removed/re-ordered). To give a unique identity to every element inside the array, a key is required.

How to Use the Spread Operator (…) in JavaScript

The spread operator is a useful and quick syntax for adding items to arrays, combining arrays or objects, and spreading an array out into a function’s arguments.

What is the spread operator?

The spread operator is a new addition to the set of operators in JavaScript ES6. It takes in an iterable (e.g an array) and expands it into individual elements. The spread operator is commonly used to make shallow copies of JS objects. Using this operator makes the code concise and enhances its readability.

What is … used for?

The spread syntax “spreads” the array into separate arguments.

What else can … do?