React.js Beginner's Notes

Source: Internet
Author: User
Tags define local

1. First match webpack and ES6 syntax.

2.let and Const:let define local variables (only valid within scope), const defines global (uniqueness)

3.es6 's Arrow function

Let Kitty = {
Age:1,
Grow:function () {
SetTimeout (() =>{
Console.log (This.age);
},1000);
}
}
Kitty.grow ();

4.Rest parameters

When the last parameter of a function is prefixed with "...", he becomes an array of arguments.
Function test (.... args) {
Console.log (args)
}
Test (+/-)

function test2 (name, ... args) {
Console.log (args)
}
Test2 (' Peter ', 2, 3)
Results [2,3]

For array data processing

Es5
var = [arr1];
var arr2 = [4,5,6];
var arr3 = Arr1.concat (ARR2);
Console.log (ARR3)
Using the expand operator
Let Arra = [n/a];
Let ARRB = [4,5,6];
Let ARRC = [... arra,... ARRB];
Console.log (ARRC)

For an object
Let Tom = {name: ' Tom ', Age: ' 18 '}
Tom = {... tom,sex: ' Boy '}
Console.log (Tom)

Template string, ES6 optimization, mainly with "'" This symbol
Let name = ' Jack ';
Let a = ' my name is ${name}! ';
Console.log (a)

React.js Beginner's Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.