标签:
ES5 | ES6 |
var | var let const |
function (){} function foo(){} | ()=>{} foo(){} |
function (){ foo:function(){} } | class A{ foo(){} } new A{} |
var name=‘aa‘, age=21; return{ name: name, age: age } | var name=‘aa‘, age=21; return{name,age} |
module.exports=A |
$(‘#id‘)
$(‘.class‘)
let $div = $(‘#div‘),
div = document.getElementById(‘div‘);
console.log($div === div)
..false
console.log(div === $div[0])
..true
console.log($(div) === $div)
..true
$.ajax({
//content
});
promise.done(fn).fail(fn).always(fn);
React
ReactDom
React.createClass({});
ReactDom.render(sources,target);
getInitialState(
return{
key: value
}
)
setState({key: value});//不能用”=”赋值
事件—>状态—>渲染
getPropTypes(
return {
key: value.isRequired//指定属性的类型.是否必须
}
)
属性由父级传入,状态由自己控制.
render(){
return {
<p ref=‘text‘ >123</p>
<button onclick=onclick() />
}
onclick(){
this.refs.text.props.value:123
}
getPropType();
getInitialState();
componentWillMount();
render();
componentDidMount();
componentWillUpdate();
render();
componentDidUpdate();
componentWillUnMount();
未完待续…
标签:
原文地址:http://www.cnblogs.com/jun3101s/p/5719795.html