@samitouri / QOS-React / commits / 0d67cc0651

Fix `commong` typo in <title> multiple children error message (#31777)

Brooke committed Dec 14, 2024 at 17:32 UTC 0d67cc065157b2b98843cd1e2578b0969765c54b
2 files changed +2 -2
packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js
+1 -1
@@ -3080,7 +3080,7 @@ function pushTitle(
3080 console.error(
3081 'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an Array with length %s instead.' +
3082 ' Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert `children` of <title> tags to a single string value' +
3083 - ' which is why Arrays of length greater than 1 are not supported. When using JSX it can be commong to combine text nodes and value nodes.' +
3083 + ' which is why Arrays of length greater than 1 are not supported. When using JSX it can be common to combine text nodes and value nodes.' +
3084 ' For example: <title>hello {nameOfUser}</title>. While not immediately apparent, `children` in this case is an Array with length 2. If your `children` prop' +
3085 ' is using this form try rewriting it using a template string: <title>{`hello ${nameOfUser}`}</title>.',
3086 children.length,
packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
+1 -1
@@ -5928,7 +5928,7 @@ describe('ReactDOMFizzServer', () => {
5928 pipe(writable);
5929 });
5930 }).toErrorDev([
5931 - 'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an Array with length 2 instead. Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert `children` of <title> tags to a single string value which is why Arrays of length greater than 1 are not supported. When using JSX it can be commong to combine text nodes and value nodes. For example: <title>hello {nameOfUser}</title>. While not immediately apparent, `children` in this case is an Array with length 2. If your `children` prop is using this form try rewriting it using a template string: <title>{`hello ${nameOfUser}`}</title>.',
5931 + 'React expects the `children` prop of <title> tags to be a string, number, bigint, or object with a novel `toString` method but found an Array with length 2 instead. Browsers treat all child Nodes of <title> tags as Text content and React expects to be able to convert `children` of <title> tags to a single string value which is why Arrays of length greater than 1 are not supported. When using JSX it can be common to combine text nodes and value nodes. For example: <title>hello {nameOfUser}</title>. While not immediately apparent, `children` in this case is an Array with length 2. If your `children` prop is using this form try rewriting it using a template string: <title>{`hello ${nameOfUser}`}</title>.',
5932 ]);
5933
5934 expect(getVisibleChildren(document.head)).toEqual(<title />);