Skip to content

Commit

Permalink
Clarifying comment for defaultChildren
Browse files Browse the repository at this point in the history
  • Loading branch information
JedWatson committed Jan 31, 2017
1 parent c6fa633 commit dbbd63b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Creatable.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,9 @@ const Creatable = React.createClass({

let { children } = this.props;

// XXX: We can't use destructuring default values to set this, because if
// we're passed null for our 'children' prop, the default value will not be
// used as babel compiles destructuring default values to:
// value === undefined ? defaultValue : value
// We can't use destructuring default values to set the children,
// because it won't apply work if `children` is null. A falsy check is
// more reliable in real world use-cases.
if (!children) {
children = defaultChildren;
}
Expand Down

0 comments on commit dbbd63b

Please sign in to comment.