TaskQueue: Error with task : undefined is not a function (evaluating 'this._renderReplies(replyCount)')
爲什麼我的函數是未定義的?
我在上面得到這個錯誤。
_renderReplies = (replyCount) => {
return (<Text>`View ${replyCount} replies`</Text>);
}
_renderItem(row) {
...
<View>{this._renderReplies(replyCount)}</View> <- Getting an error here
</View>
)
}
爲什麼我收到未定義功能錯誤????太奇怪了。
我想你忘了綁定'_renderItem'方法,正因爲如此,檢查。 –
我不認爲我需要綁定它,因爲我正在使用這個語法'_renderReplies =(replyCount)=>'我還需要綁定嗎? –
但你沒有使用'_renderItem'的箭頭函數,使用相同的方式它會工作:) –