类的创建方式有两种
var YTK_R_Project = React.createClass
和
class RootView extends Component //ES6 写法
目前发现的区别是在
写方法的命名
React.createClass是 foo: function(){};
extend 的是 foo(){};
初始化函数
React.createClass是
getInitialState: function() {
return {
selectedTab: 'practice',
};
},
如果在extend类中写 getInitialState(){}; 并不会call,
参考类的创建方式有两种
var YTK_R_Project = React.createClass
和
class RootView extends Component ////ES6 写法
目前发现的区别是在
######写方法的命名
React.createClass是 foo: function(){};
extend 的是 foo(){};
######初始化函数
React.createClass是
getInitialState: function() {
return {
selectedTab: 'practice',
};
},
ViewDidAppear
‘I find a way to simulate viewDidAppear and viewDidDisappear in UIKit,
but i'm not sure if it's a "right" way.’
[http://stackoverflow.com/questions/29619673/navigatorios-is-there-a-viewdidappear-or-viewwillappear-equivalent](http://stackoverflow.com/questions/29619673/navigatorios-is-there-a-viewdidappear-or-viewwillappear-equivalent)
参考链接:
https://facebook.github.io/react/blog/2015/01/27/react-v0.13.0-beta-1.html#es6-classes
http://stackoverflow.com/questions/31709258/why-is-getinitialstate-not-being-called-for-my-react-clas