關於TypeError: this.state.data.map is not a function的解釋

報錯原因:

array.map方法必須是“數組.map”,就是隻用數組纔有.map方法,若出現類似報錯,請檢查你調用.map方法的數據,到底是不是數組

詳細例子見我的另一篇博客:

Easy's React學習筆記(二.進階)中,19_axios數據請求的第三小節"3.axios從RAP2遠端api請求自己mock(模擬)的數據"


參考文獻:

https://stackoverflow.com/questions/39329100/uncaught-typeerror-this-state-data-map-is-not-a-function

https://stackoverflow.com/questions/59351579/react-js-typeerror-this-state-data-map-is-not-a-function

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章