return (node, index, sideEffects) => { if (isNull(node) || isUndefined(node)) return const originNode = parentNode.childNodes[i++] || null const DOM = createWithSideEffects( node, createPath(path, node.key || index), dispatch, context, {originNode} ) sideEffects.ofChildren.push(DOM.sideEffects) switch (DOM.action) { case CREATE: parentNode.appendChild(DOM.element) break case REPLACE: cache.store(parentNode.replaceChild(DOM.element, originNode)) break default: } }
children.forEach((node, index) => { if (isNull(node) || isUndefined(node)) return let childPath = createPath(path, node.key || index) let child = createElement(node, childPath, dispatch, context) DOMElement.appendChild(child) })
str += children.map((child, i) => renderString( child, context, path + '.' + (isNull(child.key) ? i : child.key), opts )).join('')