最近,我正在尝试将本机页面转换为我的应用程序的React-native页面。我遇到了使用getDefaultProps
func的疑惑问题。据我所知,当没有从父组件传入值并且有时也缓存值时,func将工作。但是当我通过isSuccess
并false
并且defalut值已设置为true
时,我将此属性设为true
。有没有人告诉我为什么以及getDefalutProps
的具体功能?
代码如下。
getDefaultProps: function() {
return {
displayData: {},
bottomStyle: 0,
isSuccess: true
};
},
render: function(){
// isSuccess is true
console.log("trade state: ", this.props.isSuccess);
很多。