What does .map() return?
- .map() will return a new UPDATED array with new values.
If i want to loop through an array and display each value in JSX, how do i do that in React?
- You would need to use curly braces {}
Each list item needs a unique ___.
- key
What is the purpose of a key?
- Keys help React identify which items have changed, are added, or are removed.
## The Spread Operator
What is the spread operator?
- refers to the use of three dots (…) to expand an iterable object into the list of arguments.
List 4 things that the spread operator can do.
- expands an iterable object
- “spreads” the array into separate arguments.
- combine two arrays, an operation known as array concatenation
-
Give an example of using the spread operator to combine two arrays.
- const myArray = [🤪,🐻,🎌]
const yourArray = [🙂,🤗,🤩]
const ourArray = […myArray,…yourArray]
Give an example of using the spread operator to add a new item to an array.
- const fewFruit = [‘🍏’,’🍊’,’🍌’]
const fewMoreFruit = [‘🍉’, ‘🍍’, …fewFruit]
Give an example of using the spread operator to combine two objects into one.
- const objectOne = {hello: “🤪”}
const objectTwo = {world: “🐻”}
const objectThree = {…objectOne, …objectTwo, laugh: “😂”}
## How to Pass Functions Between Components
In the video, what is the first step that the developer does to pass functions between components?
- creates a function wherever the state is that we’re going to change.
In your own words, what does the increment function do?
- first, we’re creating a function that will .map() through the object ‘people’ and if (p),
which is referring to the properties within the object ‘people’ === ‘name’, then it will
How can you pass a method from a parent component into a child component?
- import the specific compnonent into the child and use {this.props.___}
How does the child component invoke a method that was passed to it from a parent component?
- invoke the function using {}