es6 arrow function

Shortcut for functions, no need to  function create functions with keywords, and keywords can also be omitted  return .

this At the same time, arrow functions also inherit the keywords of the current context  .

The map function is often used in react.

for example:

[ 1 , 2 , 3 ]. map (he => he + 1 );  // [2, 3, 4] 

Equivalent to:

[ 1 , 2 , 3 ]. map (( function (he) {
   return he + 1 ; 
}).bind(this));

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325942551&siteId=291194637