Lab 03 requires updating state using the child's props in several different instances.
A new Array
By running your array through .map and returning a li. ie: const listItems = numbers.map((number) =>
- {listItems}
Key
"Keys help React identify which items have changed, are added, or are removed."
"a useful and quick syntax for adding items to arrays, combining arrays or objects, and spreading an array out into a function’s arguments."
the ... "spread syntax “spreads” the array into separate arguments."
* Copying an array
* Concatenating or combining arrays
* Using Math functions
* Using an array as arguments
* Adding an item to a list
* Adding to state in React
* Combining objects
* Converting NodeList to an array
const myArray = [1, 2, 3, 4] const yourArray = [5, 6, 7, 8] const ourArry = [...myArray, ...yourArray] console.log (...ourArray)//12345678
const number = [1, 2, 3, 4, 5] const moreNumbers= [0, ...number] console.log (moreNumbers);
let objectOne = {hello: 1} let objectTwo = {world: 2} let objectThree = {...objectOne, ...objectTwo, laugh: 3} console.log(objectThree);
by create the function wherever the state is that we are going to change.
It increases the count of the person passed in using the setState function.
By using prop
by using the prop to invoke it.