在下面的组件中,我有一个 state 属性,它在构造函数中初始化为 5。但是当我在渲染中使用它时,它返回未定义。我不明白为什么。
constructor() {
super();
this.state = {
loadcomplete: false,
twitterfeed: {
techcrunch: [],
laughingsquid: [],
appdirect: []
},
tweetCount: 30
};
}
render() {
let { tweetCount } = this.state.tweetCount;
console.log(tweetCount, "tweetcount");
return(<div></div>)
}