【发布时间】:2016-12-01 15:07:00
【问题描述】:
如何根据状态更改有条件地加载我的 React 工具栏组件?
constructor(props) {
super(props);
this.state = {
currentpagenum: 0,
};
}
render(){
return(
<View>
{this.state.currentpagenum!==0 ? this.getToolbar(): null;}
</View>
);
}
getToolbar(){
return(
<ToolbarAndroid />
);
}
【问题讨论】:
-
您遇到的错误是什么
-
去掉null后面的分号
-
谢谢
标签: javascript reactjs conditional components