1.es6
es5 |
es6 |
|
var let const |
() =>{} Foo () {} |
function () { foo:function () {} } |
class a{ foo () {} } New a{} |
var name= ' AA ', age=21; return{ name:name, age:age } |
age=21; Return{name,age} |
|
|
2.JQuery 2.1 Query:
$ (' #id ')
$ ('. Class ')
2.2 Dom and jquery object switching
Let $div = $ (' #div '),
div = document.getElementById (' div ');
Console.log ($div = = = div)
.. False
Console.log (div = = = $div [0])
.. True
Console.log ($ (div) = = = $div)
.. True
2.3 Ajax
$.ajax ({
Content
});
2.4 Promise
Promise.done (FN). Fail (FN). Always (FN);
3.React 3.1 Objects:
React
Reactdom
3.2 Methods:
React.createclass ({});
Reactdom.render (Sources,target);
3.3 Features: 3.3.1 State (status):
Getinitialstate (
return{
Key:value
}
)
SetState ({key:value});//cannot be assigned with "="
Rendering with event-status
3.3.2 Props (attributes):
Getproptypes (
return {
key:value.isrequired//Specifies the type of the property. Whether you must
}
)
Attributes are passed in by the parent, and the state is controlled by itself.
3.3.REF (internal ID):
Render () {
return {
<p ref= ' text ' >123</p>
<button Onclick=onclick ()/>
}
OnClick () {
This.refs.text.props.value:123
}
4. Life cycle
Getproptype ();
Getinitialstate ();
Componentwillmount ();
Render ();
Componentdidmount ();
Componentwillupdate ();
Render ();
Componentdidupdate ();
Componentwillunmount ();
Not to be continued ...
React Yuju Ruling