You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think our implementation of children / no children based on void components is overly complex. Rather than two code forks terminating in renders, can we have 1 fork that ensures children is undefined if void element, terminating in a single render?
I also think (though I'm not sure) that undefined children is better than empty array children.
i.e.
var children;
// If it's not a void element, check for and map children
if (!voidElementTags[type]) {
var JsonMLChildren = JsonML.getChildren(node) || [];
if (JsonMLChildren) {
children = JsonMLChildren.map((child, index) => this._visit(child, index, data));
}
}
return React.createElement(type, props, children);
The text was updated successfully, but these errors were encountered:
Honestly, I prefer the "return a single var" approach over the dual-return approach, but the latter seems to be preferred in most code I've run into here so I was kinda following that.
I think our implementation of children / no children based on void components is overly complex. Rather than two code forks terminating in renders, can we have 1 fork that ensures children is undefined if void element, terminating in a single render?
I also think (though I'm not sure) that undefined
children
is better than empty arraychildren
.i.e.
The text was updated successfully, but these errors were encountered: