【发布时间】:2017-04-03 06:42:39
【问题描述】:
当我尝试为每次按下按钮设置计数时,我遇到了上述错误。
export default class ViewIdeas extends Component{
get InitialState(){
return {
count : 0
}
}
render(){
return(
.......
<Button transparent>
<Icon name='ios-thumbs-up-outline' style={{fontSize:21}}
onPress={() => this.setState({count: ++this.state.count})}/>
<Text>{'Like' + this.state.count}</Text>
</Button>
【问题讨论】:
-
错误提示 this 为 null,或者 this.state 为 null
标签: react-native react-native-android