You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove method name prefix from warnings and errors (facebook#28432)
This pattern is a petpeeve of mine. I don't consider this best practice
and so most don't have these prefixes. Very inconsistent.
At best this is useless and noisey that you have to parse because the
information is also in the stack trace.
At worse these are misleading because they're highlighting something
internal (like validateDOMNesting) which even suggests an internal bug.
Even the ones public to React aren't necessarily what you called because
you might be calling a wrapper around it.
That would be properly reflected in a stack trace - which can also
properly ignore list so that the first stack you see is your callsite,
Which might be like `render()` in react-testing-library rather than
`createRoot()` for example.
'Cannot render a <style> outside the main document without knowing its precedence and a unique href key. React can hoist and deduplicate <style> tags if you provide a `precedence` prop along with an `href` prop that does not conflic with the `href` values used in any other hoisted <style> or <link rel="stylesheet" ...> tags. Note that hoisting <style> tags is considered an advanced feature that most will not use directly. Consider moving the <style> tag to the <head> or consider adding a `precedence="default"` and `href="some unique resource identifier"`, or move the <style> to the <style> tag.',
554
-
'Warning: validateDOMNesting(...): <style> cannot appear as a child of <html>.',
554
+
'Warning: <style> cannot appear as a child of <html>.',
'Cannot render a <link rel="stylesheet" /> outside the main document without knowing its precedence. Consider adding precedence="default" or moving it into the root <head> tag.',
577
-
'Warning: validateDOMNesting(...): <link> cannot appear as a child of <#document>.',
577
+
'Warning: <link> cannot appear as a child of <#document>.',
'Cannot render a sync or defer <script> outside the main document without knowing its order. Try adding async="" or moving it into the root <head> tag.',
594
-
'Warning: validateDOMNesting(...): <script> cannot appear as a child of <html>.',
594
+
'Warning: <script> cannot appear as a child of <html>.',
595
595
]);
596
596
597
597
awaitexpect(async()=>{
@@ -2552,11 +2552,11 @@ body {
2552
2552
'Cannot render a <style> outside the main document if it has an `itemProp` prop. `itemProp` suggests the tag belongs to an `itemScope` which can appear anywhere in the DOM. If you were intending for React to hoist this <style> remove the `itemProp` prop. Otherwise, try moving this tag into the <head> or <body> of the Document.',
2553
2553
'Cannot render a <link> outside the main document if it has an `itemProp` prop. `itemProp` suggests the tag belongs to an `itemScope` which can appear anywhere in the DOM. If you were intending for React to hoist this <link> remove the `itemProp` prop. Otherwise, try moving this tag into the <head> or <body> of the Document.',
2554
2554
'Cannot render a <script> outside the main document if it has an `itemProp` prop. `itemProp` suggests the tag belongs to an `itemScope` which can appear anywhere in the DOM. If you were intending for React to hoist this <script> remove the `itemProp` prop. Otherwise, try moving this tag into the <head> or <body> of the Document.',
2555
-
'validateDOMNesting(...): <meta> cannot appear as a child of <html>',
2556
-
'validateDOMNesting(...): <title> cannot appear as a child of <html>',
2557
-
'validateDOMNesting(...): <style> cannot appear as a child of <html>',
2558
-
'validateDOMNesting(...): <link> cannot appear as a child of <html>',
2559
-
'validateDOMNesting(...): <script> cannot appear as a child of <html>',
0 commit comments