Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const propValue = props[propName];
let Component = propValue;
if (!React.isValidElement(propValue) && isValidElementType(propValue)) {
const ownProps = {
ref: () => {},
step: {},
};
Component = ;
}
if (
is.string(propValue) ||
is.number(propValue) ||
!isValidElementType(propValue) ||
![Element, ForwardRef].includes(typeOf(Component))
) {
return new Error(
`Invalid ${location} \`${propFullName}\` supplied to \`${componentName}\`. Expected a React class or forwardRef.`,
);
}
return undefined;
},
);
export function getDisplayNameForReactElement(
element: React$Element,
): string | null {
const elementType = typeOf(element);
switch (elementType) {
case AsyncMode:
case ConcurrentMode:
return 'ConcurrentMode';
case ContextConsumer:
return 'ContextConsumer';
case ContextProvider:
return 'ContextProvider';
case ForwardRef:
return 'ForwardRef';
case Fragment:
return 'Fragment';
case Lazy:
return 'Lazy';
case Memo:
return 'Memo';
export function getDisplayNameForReactElement(
element: React$Element
): string | null {
const elementType = typeOf(element);
switch (elementType) {
case AsyncMode:
case ConcurrentMode:
return 'ConcurrentMode';
case ContextConsumer:
return 'ContextConsumer';
case ContextProvider:
return 'ContextProvider';
case ForwardRef:
return 'ForwardRef';
case Fragment:
return 'Fragment';
case Lazy:
return 'Lazy';
case Memo:
return 'Memo';