What makes this React.js code?

Hi all, I undertook to explore react, the nose is pushed with this code

var News = React.createClass({
 render: function() {
 var data = this.props.data;
 var newsTemplate = data.map(function(item, index) {
 return (
 <div key="{index}">
 <p classname="news__author">{item.author}:</p>
 <p classname="news__text">{item.text}</p>
</div>
)
})

 return (
 <div classname="news">
{newsTemplate}
</div>
);
}
});


1)var data = this.props.data - what do you mean this line? in variable, we get properties of this component?Why not just write this.props?why data at the end?
2)please explain the value to the map method. I googled based on colbeck is a function that is executed on each element - but what is passed in index and item? We do not specify explicitly call

Thanks for the clarification
July 8th 19 at 11:26
2 answers
July 8th 19 at 11:28
Solution
As said , you really need to close the knowledge gaps of the js. And then to read the tutorial on react.
Try to render a component to make the console.log(this.props) -> will be an object with the key data. Therefore, we write this.props.data.

About the map. (as it says - a Function that creates an element in the new array, taking three arguments, that's just the first two is the "current item" and "index"

p.s. the textbook chosen is fit :) , but you want to improve the basics of JS, so it will be better for learning.
hahahah)Thank you, really well written)it's pretty clear)
Like that but new to learn, but this map does not fit in the head.
This example it's clear:

var numbers = [1, 4, 9];
var doubles = numbers.map(function(num) {
return num * 2;
});

What do you recommend pociute in JS? Maybe a tutorial by Ilya Kantor?Yet the experience of jQuery, "JS Amazing" and a couple of interactives - krista.Eichma commented on July 8th 19 at 11:31
Yes, definitely, the textbook Cantor and most importantly to solve there puzzles. In terms of the theory of good Flanagan - bit.ly/297IQx8 - dannie.Stehr commented on July 8th 19 at 11:34
: Nosologic great...Thanks for the replies)Still on the gcd like this tutorial) - krista.Eichma commented on July 8th 19 at 11:37
July 8th 19 at 11:30
1. this.props - an object that contains all properties of the component. this.props.data - the data property
2. https://developer.mozilla.org/ru/docs/Web/JavaScri... - is there any argument takes a callback.

Find more questions by tags ReactJavaScript