Merge pull request #2528 from STRML/react-inline-children-fix

optimisations.react.inline: don't pass empty array.
This commit is contained in:
Sebastian McKenzie
2015-11-02 19:31:26 +00:00
3 changed files with 16 additions and 2 deletions

View File

@@ -43,8 +43,10 @@ export default function ({ types: t }) {
if (node.children.length) {
let children = t.react.buildChildren(node);
children = children.length === 1 ? children[0] : t.arrayExpression(children);
pushProp(props.properties, t.identifier("children"), children);
if (children.length) {
children = children.length === 1 ? children[0] : t.arrayExpression(children);
pushProp(props.properties, t.identifier("children"), children);
}
}
// props