1、引入文件不同:
高版本:react.production.js、 react-dom.production.min.js、browser.min.js
低版本:react.min.js、react-dom.min.js、browser.min.js
2、创建组件方式不同:
高版本:通过 类 的继承—class xx extends React.Component{}
低版本:React.createClass{}
3、生命周期所用钩子函数不同:
高版本(3个):componentWillMount、render、componentDidMount
低版本(5个):getDefaultProps、getInitialState、componentWillMount、render、componentDidMount
4、属性之间传值:
高版本:用组件defaultProps构造器传值
低版本:用钩子函数getDefaultProps传值
5、状态state不同:
高版本:在constructor中–用this.state={}初始状态,调用this.setState()需要在constructor中通过bind绑定this指向
低版本:用getInitialState()初始状态,用this.setState()更新组件的状态并在其内bind绑定this指向