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

This commit is contained in:
Brian Vaughn
2020-05-26 13:41:27 -07:00
committed by GitHub
parent 67e130fc68
commit a012858ba9
+4 -2
View File
@@ -73,7 +73,7 @@ import {checkControlledValueProps} from '../shared/ReactControlledValuePropTypes
import assertValidProps from '../shared/assertValidProps';
import dangerousStyleValue from '../shared/dangerousStyleValue';
import hyphenateStyleName from '../shared/hyphenateStyleName';
import isCustomComponent from '../shared/isCustomComponent';
import isCustomComponentFn from '../shared/isCustomComponent';
import omittedCloseTags from '../shared/omittedCloseTags';
import warnValidStyle from '../shared/warnValidStyle';
import {validateProperties as validateARIAProperties} from '../shared/ReactDOMInvalidARIAHook';
@@ -361,6 +361,8 @@ function createOpenTagMarkup(
): string {
let ret = '<' + tagVerbatim;
const isCustomComponent = isCustomComponentFn(tagLowercase, props);
for (const propKey in props) {
if (!hasOwnProperty.call(props, propKey)) {
continue;
@@ -376,7 +378,7 @@ function createOpenTagMarkup(
propValue = createMarkupForStyles(propValue);
}
let markup = null;
if (isCustomComponent(tagLowercase, props)) {
if (isCustomComponent) {
if (!RESERVED_PROPS.hasOwnProperty(propKey)) {
markup = createMarkupForCustomAttribute(propKey, propValue);
}