1, how to react to create a component
ES6: class name component extends Component {}
ES5:var App=React.createClass({})
2, render function when it will perform
When the change this.props this.state or render function performed
3, react how to modify the data state? Why is asynchronous setState
Modified using this.setState (a parameter, two parameters)
this.setState is an asynchronous function
A parameter: the need to modify the data form object
Parameter II: modified successfully callback function, where equivalent componentDidMount, DOM structure can obtain the updated data
this.setState in addition to the first parameter can be written as an object, it also can be written as a function, the first function PrevState value, the second value prePprops this.setState ((prevState, prop) => {} )
Why setState is asynchronous:
When the batch execution state of the DOM allows faster rendering, that is to say more setState also need to be incorporated in the process of implementation.