在函数完成后,我尝试设置状态,并得到了错误:
Uncaught Invariant Violation: Maximum update depth exceeded.This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate在函数完成后,我在回调中调用setstate,所以我认为从我所读到的内容来看,它可以正常工作,
我有一个API,新的数据被发布到API中。ComponentDidMount()将首次从API中启动数据。我查看了文档,发现如果添加了新的数据,componentDiUpdate()总是会重新呈现页面。actions/reducers using fetch(get)}componentDidMount() {}