Skip to content

Commit

Permalink
Use API to examine number of children
Browse files Browse the repository at this point in the history
- Prevents breaking if the internal structure of props.children changes
  in the future
  • Loading branch information
jdlehman committed Mar 28, 2016
1 parent c82c671 commit 6c75c26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var mq = React.createClass({
return null;
}
var props = omit(this.props, excludedPropKeys);
if (this.props.component || this.props.children.length > 1) {
if (this.props.component || React.Children.count(this.props.children) > 1) {
return React.createElement(
this.props.component || 'div',
props,
Expand Down

0 comments on commit 6c75c26

Please sign in to comment.