-
Notifications
You must be signed in to change notification settings - Fork 14
Support React.Fragment #84
Support React.Fragment #84
Conversation
df1d0d3
to
cb8528c
Compare
Codecov Report
@@ Coverage Diff @@
## master #84 +/- ##
=======================================
Coverage 75.37% 75.37%
=======================================
Files 8 8
Lines 134 134
Branches 31 31
=======================================
Hits 101 101
Misses 21 21
Partials 12 12
Continue to review full report at Codecov.
|
src/prepare.js
Outdated
if (typeof type === 'string') { | ||
if ( | ||
typeof type === 'string' || | ||
type.toString() === React.Fragment.toString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not type === React.Fragment
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is better, updated. Thanks!
@@ -41,7 +41,7 @@ function prepareElement(element, context) { | |||
return Promise.resolve([null, context]); | |||
} | |||
const {type, props} = element; | |||
if (typeof type === 'string') { | |||
if (typeof type === 'string' || type === React.Fragment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like we should still traverse the children here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a code example where this would be leveraged? I checked with a simple <div>
element, and this was the path that we fall into, so I imagined it would be similar to a div case. Seems like we should handle children the same in both cases?
!merge |
Fixes #84