相关疑难解决方法(0)

React JS - 未捕获的 NotFoundError:无法在“节点”上执行“insertBefore”:

我有一个divwhere 里面的另外三个divs 附加如下。状态值是通过循环来自 api 的结果来设置的componentWillReceiveProps()。但我正面临一个错误问题

Uncaught NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node

如果 api 结果为 null 得到

Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

我怎样才能解决这个问题?

componentWillReceiveProps(nextProps) {
    var sub1 = [], sub2 = [], sub3 = [];
    if(result) {
        result.sub1.map((item, index) => …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs redux

7
推荐指数
2
解决办法
8334
查看次数

标签 统计

javascript ×1

reactjs ×1

redux ×1