Skip to content

Commit

Permalink
Merge pull request #13 from smacker/empty-child
Browse files Browse the repository at this point in the history
Fix <div>{''}</div>
  • Loading branch information
Vincent Voyer committed Dec 10, 2015
2 parents b0dad59 + d837683 commit ffbfc45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,4 +417,10 @@ describe(`reactElementToJSXString(ReactElement)`, () => {
123
</div>`);
});

it(`reactElementToJSXString(<div>{''}</div>)`, () => {
expect(
reactElementToJSXString(<div>{''}</div>)
).toEqual(reactElementToJSXString(<div/>));
});
});
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,5 @@ function noChildren(propName) {
}

function onlyMeaningfulChildren(children) {
return children !== true && children !== false && children !== null;
return children !== true && children !== false && children !== null && children !== '';
}

0 comments on commit ffbfc45

Please sign in to comment.