Skip to content

Commit

Permalink
Example of the map call (#27)
Browse files Browse the repository at this point in the history
* added spaish translation

* added the result of a map call, to clarify where is the array, and how the map function works.

* fixed the word components
  • Loading branch information
sejas authored and kay-is committed Jul 18, 2018
1 parent de2fabc commit 9fa4269
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions 05-properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ <h2>{props.customData}</h2>
var planets = ["earth", "mars", "venus"]

// If an array is used as a "child node" each child needs a unique key-property
// This map call will return an array of components, like this example:
// [
// <MyComponent className="myClass" customData={"earth"} key={0}/>,
// <MyComponent className="myClass" customData={"mars"} key={1}/>,
// <MyComponent className="myClass" customData={"venus"} key={2}/>
// ]
var elements = planets.map(function(planet, index) {
return <MyComponent className="myClass" customData={planet} key={index}/>
})
Expand Down

0 comments on commit 9fa4269

Please sign in to comment.