refactor: remove emove type judgment when defining warning props (#13553)
laoxiong committed
Sep 4, 2018 at 22:03 UTC
955393cab908c054987615347fb3d5f78f1b3bf0
1 file changed
+9
-14
packages/react/src/ReactElement.js
+9
-14
@@ -229,20 +229,15 @@ export function createElement(type, config, children) {
229
}
230
if (__DEV__) {
231
if (key || ref) {
232
- if (
233
- typeof props.$$typeof === 'undefined' ||
234
- props.$$typeof !== REACT_ELEMENT_TYPE
235
- ) {
236
- const displayName =
237
- typeof type === 'function'
238
- ? type.displayName || type.name || 'Unknown'
239
- : type;
240
- if (key) {
241
- defineKeyPropWarningGetter(props, displayName);
242
- }
243
- if (ref) {
244
- defineRefPropWarningGetter(props, displayName);
245
- }
232
+ const displayName =
233
+ typeof type === 'function'
234
+ ? type.displayName || type.name || 'Unknown'
235
+ : type;
236
+ if (key) {
237
+ defineKeyPropWarningGetter(props, displayName);
238
+ }
239
+ if (ref) {
240
+ defineRefPropWarningGetter(props, displayName);
241
}
242
}
243
}