Skip to content

Commit

Permalink
Don't warn for casing if it's a custom element (facebook#21156)
Browse files Browse the repository at this point in the history
This replicates what we do on the client.
  • Loading branch information
sebmarkbage authored and acdlite committed Apr 16, 2021
1 parent 1ab36fb commit 0773a35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/react-dom/src/server/ReactDOMServerFormatConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, ' +
Expand Down
6 changes: 4 additions & 2 deletions packages/react-dom/src/server/ReactPartialRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, ' +
Expand All @@ -1348,7 +1351,6 @@ class ReactDOMServerRenderer {

validateDangerousTag(tag);

let props = element.props;
if (tag === 'input') {
if (__DEV__) {
checkControlledValueProps('input', props);
Expand Down

0 comments on commit 0773a35

Please sign in to comment.