Skip to content

Latest commit

 

History

History
44 lines (28 loc) · 1.41 KB

File metadata and controls

44 lines (28 loc) · 1.41 KB

Passing Functions as Props React Docs - lists and keys 1.What does .map() return?

.map() returns a new array, with the function block running on each item in the original array.

If I want to loop through an array and display each value in JSX, how do I do that in React? const listItems = numbers.map((number) =>

{number} cited from reactjs.org (Links to an external site.)

Each list item needs a unique Key

What is the purpose of a key?

It gives elements a stable identity.

The Spread Operator What is the spread operator? 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. cited from medium.com (Links to an external site.)

List 4 things that the spread operator can do. Copy an array, Use Math functions, Add item to a list, combine objects.

Give an example of using the spread operator to combine two arrays. (...Arr1, ...Arr2)

Give an example of using the spread operator to add a new item to an array. Give an example of using the spread operator to combine two objects into one. (...Obj1, ...Obj2)

How to Pass Functions Between Components In the video, what is the first step that the developer does to pass functions between components? Number and name of feature: Feature #1: Display images

Estimate of time needed to complete: 30 mins

Start time: 2:40

Finish time: 3:45

Actual time needed to complete: 1:05