TypeError:this.state.article.map不是函数REACT

时间:2018-04-28 13:39:49

标签: reactjs

如何修复此错误:TypeError:this.state.article.map不是函数

enter image description here

CODE:

enter image description here

1 个答案:

答案 0 :(得分:1)

您收到一个对象 - 一篇“文章”。您需要将其作为数组的元素:

this.setState({ article: [data] })