Don't warn for casing if it's a custom element (#21156)

This replicates what we do on the client.
This commit is contained in:
Sebastian Markbåge
2021-03-31 18:10:27 -07:00
committed by GitHub
parent 9ed0167945
commit 588db2e1fc
2 changed files with 9 additions and 3 deletions
@@ -1211,7 +1211,11 @@ export function pushStartInstance(
formatContext.insertionMode !== SVG_MODE &&
formatContext.insertionMode !== MATHML_MODE
) {
if (type.toLowerCase() !== type) {
if (
type.indexOf('-') === -1 &&
typeof props.is !== 'string' &&
type.toLowerCase() !== type
) {
console.error(
'<%s /> is using incorrect casing. ' +
'Use PascalCase for React components, ' +
+4 -2
View File
@@ -1331,11 +1331,14 @@ class ReactDOMServerRenderer {
namespace = getIntrinsicNamespace(tag);
}
let props = element.props;
if (__DEV__) {
if (namespace === HTML_NAMESPACE) {
const isCustomComponent = isCustomComponentFn(tag, props);
// Should this check be gated by parent namespace? Not sure we want to
// allow <SVG> or <mATH>.
if (tag.toLowerCase() !== element.type) {
if (!isCustomComponent && tag.toLowerCase() !== element.type) {
console.error(
'<%s /> is using incorrect casing. ' +
'Use PascalCase for React components, ' +
@@ -1348,7 +1351,6 @@ class ReactDOMServerRenderer {
validateDangerousTag(tag);
let props = element.props;
if (tag === 'input') {
if (__DEV__) {
checkControlledValueProps('input', props);