Skip to content

Commit

Permalink
feat: avoid cloning top level arrays in props (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
le0nik authored and gajus committed Aug 11, 2017
1 parent bb23402 commit 6d043d5
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/linkClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,7 @@ const linkElement = (element: ReactElement, styles: Object, configuration: Objec
if (React.isValidElement(propValue)) {
elementShallowCopy.props[propName] = linkElement(React.Children.only(propValue), styles, configuration);
} else if (_.isArray(propValue)) {
elementShallowCopy.props[propName] = _.map(propValue, (node) => {
if (React.isValidElement(node)) {
return linkElement(React.Children.only(node), styles, configuration);
} else if (_.isArray(node)) {
return linkArray(node, styles, configuration);
}

return node;
});
elementShallowCopy.props[propName] = linkArray(propValue, styles, configuration);
}
});

Expand Down

0 comments on commit 6d043d5

Please sign in to comment.