我有一个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)