Skip to content

Commit 8800d72

Browse files
sebmarkbagekoto
authored andcommitted
Don't warn for casing if it's a custom element (facebook#21156)
This replicates what we do on the client.
1 parent d40393f commit 8800d72

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/react-dom/src/server/ReactDOMServerFormatConfig.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,11 @@ export function pushStartInstance(
12111211
formatContext.insertionMode !== SVG_MODE &&
12121212
formatContext.insertionMode !== MATHML_MODE
12131213
) {
1214-
if (type.toLowerCase() !== type) {
1214+
if (
1215+
type.indexOf('-') === -1 &&
1216+
typeof props.is !== 'string' &&
1217+
type.toLowerCase() !== type
1218+
) {
12151219
console.error(
12161220
'<%s /> is using incorrect casing. ' +
12171221
'Use PascalCase for React components, ' +

packages/react-dom/src/server/ReactPartialRenderer.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,11 +1331,14 @@ class ReactDOMServerRenderer {
13311331
namespace = getIntrinsicNamespace(tag);
13321332
}
13331333

1334+
let props = element.props;
1335+
13341336
if (__DEV__) {
13351337
if (namespace === HTML_NAMESPACE) {
1338+
const isCustomComponent = isCustomComponentFn(tag, props);
13361339
// Should this check be gated by parent namespace? Not sure we want to
13371340
// allow <SVG> or <mATH>.
1338-
if (tag.toLowerCase() !== element.type) {
1341+
if (!isCustomComponent && tag.toLowerCase() !== element.type) {
13391342
console.error(
13401343
'<%s /> is using incorrect casing. ' +
13411344
'Use PascalCase for React components, ' +
@@ -1348,7 +1351,6 @@ class ReactDOMServerRenderer {
13481351

13491352
validateDangerousTag(tag);
13501353

1351-
let props = element.props;
13521354
if (tag === 'input') {
13531355
if (__DEV__) {
13541356
checkControlledValueProps('input', props);

0 commit comments

Comments
 (0)