ES5
var React = require('react');
var ReactDOM = require('react-dom');
// 定义组件
var HelloMessage = React.createClass({
render: function() {
return <div> React,我们来了... </div>;
}
});
// 组件渲染
ReactDOM.render(<HelloMessage />, rootElement);
································································································
ES6
import React, { Component } from 'react';
import { render } from 'react-dom';
// 定义组件
class SimpleComponent extends Component {
render(){
return <div> React,我们来了... </div>;
}
}
// 组件渲染
render(<HelloMessage />, rootElement);
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
React.js
React.Children: Object
React.Component: ReactComponent(props, context, updater)
React.DOM: Object
React.PropTypes: Object
React.cloneElement: (element, props, children)
React.createClass: (spec)
React.createElement: (type, props, children)
React.createFactory: (type)
React.createMixin: (mixin)
React.
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````
Component API
this.context: Object
this.props: Object
this.refs: Object
this.state: Object
this.setState: Object
······························································································································
react-dom.js
ReactDOM.findDOMNode: findDOMNode(componentOrElement)
ReactDOM.render: ()
ReactDOM.unmountComponentAtNode: (container)