@samitouri / QOS-React-2 / commits / a012858ba9

Move isCustomComponent() function call outside of loop (#19007)

Brian Vaughn committed May 26, 2020 at 13:41 UTC a012858ba9e35f2eacbd0a63cdc157989d1fb884
1 file changed +4 -2
packages/react-dom/src/server/ReactPartialRenderer.js
+4 -2
@@ -73,7 +73,7 @@ import {checkControlledValueProps} from '../shared/ReactControlledValuePropTypes
73 import assertValidProps from '../shared/assertValidProps';
74 import dangerousStyleValue from '../shared/dangerousStyleValue';
75 import hyphenateStyleName from '../shared/hyphenateStyleName';
76 -import isCustomComponent from '../shared/isCustomComponent';
76 +import isCustomComponentFn from '../shared/isCustomComponent';
77 import omittedCloseTags from '../shared/omittedCloseTags';
78 import warnValidStyle from '../shared/warnValidStyle';
79 import {validateProperties as validateARIAProperties} from '../shared/ReactDOMInvalidARIAHook';
@@ -361,6 +361,8 @@ function createOpenTagMarkup(
361 ): string {
362 let ret = '<' + tagVerbatim;
363
364 + const isCustomComponent = isCustomComponentFn(tagLowercase, props);
365 +
366 for (const propKey in props) {
367 if (!hasOwnProperty.call(props, propKey)) {
368 continue;
@@ -376,7 +378,7 @@ function createOpenTagMarkup(
378 propValue = createMarkupForStyles(propValue);
379 }
380 let markup = null;
379 - if (isCustomComponent(tagLowercase, props)) {
381 + if (isCustomComponent) {
382 if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
383 markup = createMarkupForCustomAttribute(propKey, propValue);
384 }