Skip to content

Commit 7e5ce19

Browse files
committed
Fix diverging behavior of ReactFragment in __DEV__
We could also remove the return statements but this is not a hot path and this seems safer.
1 parent 0ff65cc commit 7e5ce19

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/addons/ReactFragment.js

+16-17
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,23 @@ var ReactFragment = {
4646
// Wrap a keyed object in an opaque proxy that warns you if you access any
4747
// of its properties.
4848
create: function(object) {
49-
if (__DEV__) {
50-
if (typeof object !== 'object' || !object || Array.isArray(object)) {
51-
warning(
52-
false,
53-
'React.addons.createFragment only accepts a single object. Got: %s',
54-
object
55-
);
56-
return object;
57-
}
58-
if (ReactElement.isValidElement(object)) {
59-
warning(
60-
false,
61-
'React.addons.createFragment does not accept a ReactElement ' +
62-
'without a wrapper object.'
63-
);
64-
return object;
65-
}
49+
if (typeof object !== 'object' || !object || Array.isArray(object)) {
50+
warning(
51+
false,
52+
'React.addons.createFragment only accepts a single object. Got: %s',
53+
object
54+
);
55+
return object;
6656
}
57+
if (ReactElement.isValidElement(object)) {
58+
warning(
59+
false,
60+
'React.addons.createFragment does not accept a ReactElement ' +
61+
'without a wrapper object.'
62+
);
63+
return object;
64+
}
65+
6766
invariant(
6867
object.nodeType !== 1,
6968
'React.addons.createFragment(...): Encountered an invalid child; DOM ' +

0 commit comments

Comments
 (0)