readingnotes

View project on GitHub

Lists and keys

  • What does .map() return? after iterate on array its return the new value.

  • If I want to loop through an array and display each value in JSX, how do I do that in React? write array then using map to iterates through an array and call value then but every value in JSX.

  • 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.Source


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.

  • List 4 things that the spread operator can do. Copying an array,Concatenating or combining arrays,Using Math functions,Using an array as arguments.

  • Give an example of using the spread operator to combine two arrays. let arr1 = [a,b,c] let arr2 = [d,e,f] let arr3 = […arr1, …arr2] //[a,b,c,d,e,f]

  • Give an example of using the spread operator to add a new item to an array. let arr1=[a,b,c] let arr2=[…arr1,d]//[a,b,c,d]

  • Give an example of using the spread operator to combine two objects into one. let arr1=[a,b,c] let arr2=[d,e,f] let arr3=[…arr1,…arr2,g]//[a,b,c,d,e,f,g]

ArticleSource


How to Pass Functions Between Components

  • In the video, what is the first step that the developer does to pass functions between components? looping through the array genrating these objects,using array map method.

  • In your own words, what does the increment function do? change the state.

  • How can you pass a method from a parent component into a child component? calling parent by passing the state of it then call using the props in child.

  • How does the child component invoke a method that was passed to it from a parent component? using state.


Things I want to know more about