Skip to content

Latest commit

 

History

History
48 lines (29 loc) · 1.71 KB

File metadata and controls

48 lines (29 loc) · 1.71 KB

Passing Functions as Props

What does .map()

The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.

display each value in JSX

.map() in JavaScript iterates through an array and calls a specified function for each of the items. Components in JSX are JS functions. For each object in the array, a block of JSX elements is returned.

Also, data from the object is passed to each block using the JSX handlebars-like curly brackets.

In the App() component of src/index.js iterate over the imported data using .map()


How to Use the Spread Operator (…) in JavaScript

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.

What is the spread operator?

JavaScript, spread syntax refers to the use of an ellipsis of three dots (…) to expand an iterable object into the list of arguments.

What else can … do?

The … spread operator is useful for many different routine tasks in JavaScript, including the following:

  • 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

For More Info How to Pass Functions between Components


Things I want to know more about

i want to know more about using map in the react and we can can get use it in real web app .