React Docs Lists and Keys The Spread Operator How to pass functions between components React Tutorial through Declaring a Winner React Docs Lifting state up
a new array with the same lenth as the origianl array
you use the .map() function. create an array then use the .map() function to iterate over each element in the array.
key attribute
The purpose of a key in React is to help React identify each list item uniquely when rendering lists dynamically.
The spread operator (…) in JavaScript allows you to expand iterable objects, such as arrays or objects, into individual elements.
Copying Arrays and Objects, Concaterating Arrays, Passing Arguments, Merging Objects
const array1 = [1, 2, 3] const array2 = [4, 5, 6] const combinedArray = […array1, …array2]
const array1 = [1, 2, 3] const newItem = 4 const newArray = […array1,newItem]
const object1 = { number: 1, colour: red} const object2 = { number: 2, colour: blue} const combineOpject = {…object1,object2}
the first step typically involves defining the function in the parent component that you want to pass to a child component. This function is usually defined as a method within the parent component’s class or as a regular function within the parent component.
its a custom function that increass a counter or can update a value
To pass a method from a parent component to a child component in React, you can pass the method as a prop to the child component. This allows the child component to access and invoke the method
By invoking this.props.increment in the child component, it calls the increment method defined in the parent component, allowing the child component to trigger the parent’s functionality.