類的創(chuàng)建方式有兩種
var YTK_R_Project = React.createClass
和
class RootView extends Component //ES6 寫法
目前發(fā)現(xiàn)的區(qū)別是在
寫方法的命名
React.createClass是 foo: function(){};
extend 的是 foo(){};
初始化函數(shù)
React.createClass是
getInitialState: function() {
return {
selectedTab: 'practice',
};
},
如果在extend類中寫 getInitialState(){}; 并不會call禽翼,
參考類的創(chuàng)建方式有兩種
var YTK_R_Project = React.createClass
和
class RootView extends Component ////ES6 寫法
目前發(fā)現(xiàn)的區(qū)別是在
######寫方法的命名
React.createClass是 foo: function(){};
extend 的是 foo(){};
######初始化函數(shù)
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