ES6 与 React

Node和NPM
/*安装npm*/
npm install
npm install <package>
npm install -g <package>

/*更新安装包*/
npm update <package>
npm update -g <package>

卸载安装包
npm uninstall <package>
npm uninstall -g <package>

React项目搭建命令
/*安装React
npm install -g create-react-app

/*创建项目*/
create-react-app my-app

/*进入项目所在的目录*/
cd my-app

/*启动项目*/
npm start

/*安装依赖*/
npm install

/*编译项目*/
npm run build

安装webpack和webpack-cli
npm install --save-dev webpack webpack-cli -g

GIT GUI(可视化工具)
https://blog.csdn.net/qq_15509267/article/details/83617029

 GUI 教程

https://www.liaoxuefeng.com/wiki/896043488029600

/*初始化仓库*/
git init

/*添加文件到本地仓库*/
git add .(文件name)

/*添加文件描述信息*/
git commit -m "first commit"

/*链接远程仓库,创建主分支*/
git remote add origin + 远程仓库地址

/*把本地仓库的变化连接到远程仓库主分支*/
git pull origin master

/*把本地仓库的文件推送到远程仓库*/
git push -u origin master


从GitHub向本地down文件
git clone '代码仓库的SSH地址'

打包工具
webpack是一个打包工具
https://blog.csdn.net/u010289890/article/details/82663082


taro和dva
https://taro.aotu.io
https://dvajs.com
/*安装taro (cnpm为淘宝镜像)*/
cnpm install -g @tarojs/cli

/*创建项目*/
taro init taro-demo

/*安装与 react-redux*/
cnpm install --save redux @tarojs/redux @tarojs/redux-h5 redux-thunk redux-logger

/*安装dva*/
cnpm install --save dva-core dva-loading

命令:
var let const

数组解构赋值:
let [a = 1] = [];
let [a, b, c] = [1, 2, 3];
let [a, b, c] = new Set([1, 2, 3]);

对象解构赋值:
let { log, sin, cos } = Math;
let { a, b } = { a: 1, b: 2 };
let x; ({ x } = { x: 1 });

字符串解构赋值
const [a, b, c] = '123';
let { length: len } = '123';

函数参数解构赋值
function func([x, y])
var f = v => v; 等同于 var f = function (v) { return v; };
(() => { console.log(1); })();

遍历 Map 结构
const items = new Map();
items.set(1, 2);
items.set(3, 4);
for (let [key, value] of items) { key + value } 或者 [[1, 2], [3, 4]].map(([a, b]) => a + b);

输入模块的指定方法
const { fn, func } = require("source-map");

字符的 Unicode 表示法
let txt = "u0061";
let txt = "u{0061}";

字符串的遍历器接口
(let i of text)
 模板字符串,用反引号(`)标识
字符串中嵌入变量
let name = "micro";
var txt = `Name ${name}`

数据结构 Set
const s = new Set([1, 2, 3, 4, 4]);

const s = new Set();
[2, 3, 5, 4, 5, 2, 2].forEach(x => s.add(x));
for (let i of s)

Class 语法
class Func {
    constructor() { }
    add(x, y) {
        return x + y;
    }
    get prop() {
        return 0;
    }
    set prop(value) {
        console.log(value);
    }
}
let fn = new Func();
fn.add(1, 2)

let Func = new class {}

静态方法和属性
class Func {
    static prop = 1;
    static add(x, y) {
        return x + y;
    }        
}

私有方法和私有属性
class Func {
    add(x, y) {
        fn.call(this, x, y);
    }
}
function fn(x, y) { }

类继承静态方法
class Fn extends Func { }
        
Module 的语法
<script type="module"></script>

原文地址:https://www.cnblogs.com/sntetwt/p/10776116.html