我正面臨上面提到的錯誤,當我試圖爲每次按下按鈕時設置計數。null不是一個對象(評估this.state.count)
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>