@samitouri / QOS-React-2 / commits / dbfbfb3312

Update error messages (#28652)

## Overview The error messages that say: > ReactDOM.hydrate is no longer supported in React 18 Don't make sense in the React 19 release. Instead, they should say: > ReactDOM.hydrate was removed in React 19. For legacy mode, they should say: > ReactDOM.hydrate has not been supported since React 18.

Ricky committed Mar 26, 2024 at 17:25 UTC dbfbfb3312db019183ef92fd2ef110cc7d807e80
21 files changed +124 -65
packages/react-devtools-shared/src/__tests__/inspectedElement-test.js
+1 -1
@@ -2159,7 +2159,7 @@ describe('InspectedElement', () => {
2159 const container = document.createElement('div');
2160 container.innerHTML = '<div></div>';
2161 withErrorsOrWarningsIgnored(
2162 - ['ReactDOM.hydrate is no longer supported in React 18'],
2162 + ['ReactDOM.hydrate has not been supported since React 18'],
2163 () => {
2164 ReactDOM.hydrate(<Example />, container);
2165 },
packages/react-devtools-shared/src/__tests__/utils.js
+2 -2
@@ -151,7 +151,7 @@ export function getLegacyRenderImplementation(): RenderImplementation {
151
152 function render(elements) {
153 withErrorsOrWarningsIgnored(
154 - ['ReactDOM.render is no longer supported in React 18'],
154 + ['ReactDOM.render has not been supported since React 18'],
155 () => {
156 ReactDOM.render(elements, container);
157 },
@@ -340,7 +340,7 @@ export function legacyRender(elements, container) {
340
341 const ReactDOM = require('react-dom');
342 withErrorsOrWarningsIgnored(
343 - ['ReactDOM.render is no longer supported in React 18'],
343 + ['ReactDOM.render has not been supported since React 18'],
344 () => {
345 ReactDOM.render(elements, container);
346 },
packages/react-devtools-shell/src/app/index.js
+1 -1
@@ -30,7 +30,7 @@ ignoreErrors([
30 'Warning: Legacy context API',
31 'Warning: Unsafe lifecycle methods',
32 'Warning: %s is deprecated in StrictMode.', // findDOMNode
33 - 'Warning: ReactDOM.render is no longer supported in React 18',
33 + 'Warning: ReactDOM.render was removed in React 19',
34 ]);
35 ignoreWarnings(['Warning: componentWillReceiveProps has been renamed']);
36 ignoreLogs([]);
packages/react-dom/src/__tests__/ReactDOMConsoleErrorReportingLegacy-test.js
+70 -14
@@ -93,7 +93,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
93 ],
94 ]);
95 expect(console.error.mock.calls).toEqual([
96 - [expect.stringContaining('ReactDOM.render is no longer supported')],
96 + [
97 + expect.stringContaining(
98 + 'ReactDOM.render has not been supported since React 18',
99 + ),
100 + ],
101 [
102 // Reported because we're in a browser click event:
103 expect.objectContaining({
@@ -136,7 +140,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
140 expect(windowOnError.mock.calls).toEqual([]);
141 if (__DEV__) {
142 expect(console.error.mock.calls).toEqual([
139 - [expect.stringContaining('ReactDOM.render is no longer supported')],
143 + [
144 + expect.stringContaining(
145 + 'ReactDOM.render has not been supported since React 18',
146 + ),
147 + ],
148 ]);
149 }
150
@@ -157,7 +165,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
165
166 if (__DEV__) {
167 expect(console.error.mock.calls).toEqual([
160 - [expect.stringContaining('ReactDOM.render is no longer supported')],
168 + [
169 + expect.stringContaining(
170 + 'ReactDOM.render has not been supported since React 18',
171 + ),
172 + ],
173 [
174 // Formatting
175 expect.stringContaining('%o'),
@@ -196,7 +208,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
208 expect(windowOnError.mock.calls).toEqual([]);
209 if (__DEV__) {
210 expect(console.error.mock.calls).toEqual([
199 - [expect.stringContaining('ReactDOM.render is no longer supported')],
211 + [
212 + expect.stringContaining(
213 + 'ReactDOM.render has not been supported since React 18',
214 + ),
215 + ],
216 ]);
217 }
218 });
@@ -221,7 +237,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
237 if (__DEV__) {
238 expect(windowOnError.mock.calls).toEqual([]);
239 expect(console.error.mock.calls).toEqual([
224 - [expect.stringContaining('ReactDOM.render is no longer supported')],
240 + [
241 + expect.stringContaining(
242 + 'ReactDOM.render has not been supported since React 18',
243 + ),
244 + ],
245 [
246 // Formatting
247 expect.stringContaining('%o'),
@@ -260,7 +280,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
280 expect(windowOnError.mock.calls).toEqual([]);
281 if (__DEV__) {
282 expect(console.error.mock.calls).toEqual([
263 - [expect.stringContaining('ReactDOM.render is no longer supported')],
283 + [
284 + expect.stringContaining(
285 + 'ReactDOM.render has not been supported since React 18',
286 + ),
287 + ],
288 ]);
289 }
290 });
@@ -283,7 +307,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
307 if (__DEV__) {
308 expect(windowOnError.mock.calls).toEqual([]);
309 expect(console.error.mock.calls).toEqual([
286 - [expect.stringContaining('ReactDOM.render is no longer supported')],
310 + [
311 + expect.stringContaining(
312 + 'ReactDOM.render has not been supported since React 18',
313 + ),
314 + ],
315 [
316 // Formatting
317 expect.stringContaining('%o'),
@@ -322,7 +350,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
350 expect(windowOnError.mock.calls).toEqual([]);
351 if (__DEV__) {
352 expect(console.error.mock.calls).toEqual([
325 - [expect.stringContaining('ReactDOM.render is no longer supported')],
353 + [
354 + expect.stringContaining(
355 + 'ReactDOM.render has not been supported since React 18',
356 + ),
357 + ],
358 ]);
359 }
360 });
@@ -350,7 +382,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
382 if (__DEV__) {
383 expect(windowOnError.mock.calls).toEqual([]);
384 expect(console.error.mock.calls).toEqual([
353 - [expect.stringContaining('ReactDOM.render is no longer supported')],
385 + [
386 + expect.stringContaining(
387 + 'ReactDOM.render has not been supported since React 18',
388 + ),
389 + ],
390 [
391 // Formatting
392 expect.stringContaining('%o'),
@@ -389,7 +425,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
425 expect(windowOnError.mock.calls).toEqual([]);
426 if (__DEV__) {
427 expect(console.error.mock.calls).toEqual([
392 - [expect.stringContaining('ReactDOM.render is no longer supported')],
428 + [
429 + expect.stringContaining(
430 + 'ReactDOM.render has not been supported since React 18',
431 + ),
432 + ],
433 ]);
434 }
435 });
@@ -413,7 +453,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
453 if (__DEV__) {
454 expect(windowOnError.mock.calls).toEqual([]);
455 expect(console.error.mock.calls).toEqual([
416 - [expect.stringContaining('ReactDOM.render is no longer supported')],
456 + [
457 + expect.stringContaining(
458 + 'ReactDOM.render has not been supported since React 18',
459 + ),
460 + ],
461 [
462 // Formatting
463 expect.stringContaining('%o'),
@@ -452,7 +496,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
496 expect(windowOnError.mock.calls).toEqual([]);
497 if (__DEV__) {
498 expect(console.error.mock.calls).toEqual([
455 - [expect.stringContaining('ReactDOM.render is no longer supported')],
499 + [
500 + expect.stringContaining(
501 + 'ReactDOM.render has not been supported since React 18',
502 + ),
503 + ],
504 ]);
505 }
506 });
@@ -480,7 +528,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
528 if (__DEV__) {
529 expect(windowOnError.mock.calls).toEqual([]);
530 expect(console.error.mock.calls).toEqual([
483 - [expect.stringContaining('ReactDOM.render is no longer supported')],
531 + [
532 + expect.stringContaining(
533 + 'ReactDOM.render has not been supported since React 18',
534 + ),
535 + ],
536 [
537 // Formatting
538 expect.stringContaining('%o'),
@@ -519,7 +571,11 @@ describe('ReactDOMConsoleErrorReporting', () => {
571 expect(windowOnError.mock.calls).toEqual([]);
572 if (__DEV__) {
573 expect(console.error.mock.calls).toEqual([
522 - [expect.stringContaining('ReactDOM.render is no longer supported')],
574 + [
575 + expect.stringContaining(
576 + 'ReactDOM.render has not been supported since React 18',
577 + ),
578 + ],
579 ]);
580 }
581 });
packages/react-dom/src/__tests__/ReactDOMLegacyFiber-test.js
+2 -2
@@ -1193,10 +1193,10 @@ describe('ReactDOMLegacyFiber', () => {
1193 if (__DEV__) {
1194 expect(console.error).toHaveBeenCalledTimes(2);
1195 expect(console.error.mock.calls[0][0]).toMatch(
1196 - 'ReactDOM.render is no longer supported in React 18',
1196 + 'ReactDOM.render has not been supported since React 18',
1197 );
1198 expect(console.error.mock.calls[1][0]).toMatch(
1199 - 'ReactDOM.render is no longer supported in React 18',
1199 + 'ReactDOM.render has not been supported since React 18',
1200 );
1201 }
1202 });
packages/react-dom/src/__tests__/ReactErrorBoundaries-test.internal.js
+2 -2
@@ -919,8 +919,8 @@ describe('ReactErrorBoundaries', () => {
919 ...gate(flags =>
920 flags.disableLegacyContext
921 ? [
922 - 'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which is no longer supported. Use React.createContext() instead.',
923 - 'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which is no longer supported. Use React.createContext() instead.',
922 + 'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead.',
923 + 'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead.',
924 ]
925 : [],
926 ),
packages/react-dom/src/__tests__/ReactLegacyContextDisabled-test.internal.js
+6 -6
@@ -97,11 +97,11 @@ describe('ReactLegacyContextDisabled', () => {
97 );
98 });
99 }).toErrorDev([
100 - 'LegacyProvider uses the legacy childContextTypes API which is no longer supported. ' +
100 + 'LegacyProvider uses the legacy childContextTypes API which was removed in React 19. ' +
101 'Use React.createContext() instead.',
102 - 'LegacyClsConsumer uses the legacy contextTypes API which is no longer supported. ' +
102 + 'LegacyClsConsumer uses the legacy contextTypes API which was removed in React 19. ' +
103 'Use React.createContext() with static contextType instead.',
104 - 'LegacyFnConsumer uses the legacy contextTypes API which is no longer supported. ' +
104 + 'LegacyFnConsumer uses the legacy contextTypes API which was removed in React 19. ' +
105 'Use React.createContext() with React.useContext() instead.',
106 ]);
107 expect(container.textContent).toBe('{}undefinedundefined');
@@ -137,11 +137,11 @@ describe('ReactLegacyContextDisabled', () => {
137 container,
138 );
139 }).toErrorDev([
140 - 'LegacyProvider uses the legacy childContextTypes API which is no longer supported. ' +
140 + 'LegacyProvider uses the legacy childContextTypes API which was removed in React 19. ' +
141 'Use React.createContext() instead.',
142 - 'LegacyClsConsumer uses the legacy contextTypes API which is no longer supported. ' +
142 + 'LegacyClsConsumer uses the legacy contextTypes API which was removed in React 19. ' +
143 'Use React.createContext() with static contextType instead.',
144 - 'LegacyFnConsumer uses the legacy contextTypes API which is no longer supported. ' +
144 + 'LegacyFnConsumer uses the legacy contextTypes API which was removed in React 19. ' +
145 'Use React.createContext() with React.useContext() instead.',
146 ]);
147 expect(text).toBe('<span>{}<!-- -->undefined<!-- -->undefined</span>');
packages/react-dom/src/__tests__/ReactLegacyErrorBoundaries-test.internal.js
+3 -3
@@ -684,7 +684,7 @@ describe('ReactLegacyErrorBoundaries', () => {
684 if (__DEV__) {
685 expect(console.error).toHaveBeenCalledTimes(2);
686 expect(console.error.mock.calls[0][0]).toContain(
687 - 'ReactDOM.render is no longer supported',
687 + 'ReactDOM.render has not been supported since React 18',
688 );
689 expect(console.error.mock.calls[1][2]).toContain(
690 'The above error occurred in the <BrokenRender> component:',
@@ -869,8 +869,8 @@ describe('ReactLegacyErrorBoundaries', () => {
869 ...gate(flags =>
870 flags.disableLegacyContext
871 ? [
872 - 'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which is no longer supported. Use React.createContext() instead.',
873 - 'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which is no longer supported. Use React.createContext() instead.',
872 + 'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead.',
873 + 'Warning: BrokenComponentWillMountWithContext uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead.',
874 ]
875 : [],
876 ),
packages/react-dom/src/__tests__/ReactLegacyRootWarnings-test.js
+2 -2
@@ -22,7 +22,7 @@ describe('ReactDOMRoot', () => {
22 if (__DEV__) {
23 expect(console.error).toHaveBeenCalledTimes(1);
24 expect(console.error.mock.calls[0][0]).toContain(
25 - 'ReactDOM.render is no longer supported',
25 + 'ReactDOM.render has not been supported since React 18',
26 );
27 }
28 });
@@ -37,7 +37,7 @@ describe('ReactDOMRoot', () => {
37 if (__DEV__) {
38 expect(console.error).toHaveBeenCalledTimes(1);
39 expect(console.error.mock.calls[0][0]).toContain(
40 - 'ReactDOM.hydrate is no longer supported',
40 + 'ReactDOM.hydrate has not been supported since React 18',
41 );
42 }
43 });
packages/react-dom/src/__tests__/renderSubtreeIntoContainer-test.js
+9 -9
@@ -54,7 +54,7 @@ describe('renderSubtreeIntoContainer', () => {
54 renderSubtreeIntoContainer(this, <Component />, portal);
55 }.bind(this),
56 ).toErrorDev(
57 - 'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
57 + 'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
58 );
59 }
60 }
@@ -107,7 +107,7 @@ describe('renderSubtreeIntoContainer', () => {
107 expect(() => {
108 renderSubtreeIntoContainer(this, <Component />, portal);
109 }).toErrorDev(
110 - 'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
110 + 'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
111 );
112 }
113
@@ -115,7 +115,7 @@ describe('renderSubtreeIntoContainer', () => {
115 expect(() => {
116 renderSubtreeIntoContainer(this, <Component />, portal);
117 }).toErrorDev(
118 - 'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
118 + 'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
119 );
120 }
121 }
@@ -172,7 +172,7 @@ describe('renderSubtreeIntoContainer', () => {
172 expect(() => {
173 renderSubtreeIntoContainer(this, <Component />, portal);
174 }).toErrorDev(
175 - 'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
175 + 'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
176 );
177 }
178
@@ -180,7 +180,7 @@ describe('renderSubtreeIntoContainer', () => {
180 expect(() => {
181 renderSubtreeIntoContainer(this, <Component />, portal);
182 }).toErrorDev(
183 - 'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
183 + 'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
184 );
185 }
186 }
@@ -211,7 +211,7 @@ describe('renderSubtreeIntoContainer', () => {
211 expect(() => {
212 renderSubtreeIntoContainer(this, <div>hello</div>, portal);
213 }).toErrorDev(
214 - 'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
214 + 'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
215 );
216 }
217 }
@@ -250,7 +250,7 @@ describe('renderSubtreeIntoContainer', () => {
250 expect(() => {
251 renderSubtreeIntoContainer(this, <Child />, portal);
252 }).toErrorDev(
253 - 'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
253 + 'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
254 );
255 }
256 }
@@ -290,7 +290,7 @@ describe('renderSubtreeIntoContainer', () => {
290 expect(() => {
291 renderSubtreeIntoContainer(this, <Middle />, portal1);
292 }).toErrorDev(
293 - 'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
293 + 'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
294 );
295 }
296 static childContextTypes = {
@@ -306,7 +306,7 @@ describe('renderSubtreeIntoContainer', () => {
306 expect(() => {
307 renderSubtreeIntoContainer(this, <Child />, portal2);
308 }).toErrorDev(
309 - 'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported',
309 + 'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported since React 18',
310 );
311 }
312 }
packages/react-dom/src/client/ReactDOMLegacy.js
+8 -8
@@ -268,14 +268,14 @@ export function hydrate(
268 if (disableLegacyMode) {
269 if (__DEV__) {
270 console.error(
271 - 'ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot instead',
271 + 'ReactDOM.hydrate was removed in React 19. Use hydrateRoot instead',
272 );
273 }
274 throw new Error('ReactDOM: Unsupported Legacy Mode API.');
275 }
276 if (__DEV__) {
277 console.error(
278 - 'ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot ' +
278 + 'ReactDOM.hydrate has not been supported since React 18. Use hydrateRoot ' +
279 'instead. Until you switch to the new API, your app will behave as ' +
280 "if it's running React 17. Learn " +
281 'more: https://react.dev/link/switch-to-createroot',
@@ -316,14 +316,14 @@ export function render(
316 if (disableLegacyMode) {
317 if (__DEV__) {
318 console.error(
319 - 'ReactDOM.render is no longer supported in React 18. Use createRoot instead.',
319 + 'ReactDOM.render was removed in React 19. Use createRoot instead.',
320 );
321 }
322 throw new Error('ReactDOM: Unsupported Legacy Mode API.');
323 }
324 if (__DEV__) {
325 console.error(
326 - 'ReactDOM.render is no longer supported in React 18. Use createRoot ' +
326 + 'ReactDOM.render has not been supported since React 18. Use createRoot ' +
327 'instead. Until you switch to the new API, your app will behave as ' +
328 "if it's running React 17. Learn " +
329 'more: https://react.dev/link/switch-to-createroot',
@@ -364,15 +364,15 @@ export function unstable_renderSubtreeIntoContainer(
364 if (disableLegacyMode) {
365 if (__DEV__) {
366 console.error(
367 - 'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported in React 18. Consider using a portal instead.',
367 + 'ReactDOM.unstable_renderSubtreeIntoContainer() was removed in React 19. Consider using a portal instead.',
368 );
369 }
370 throw new Error('ReactDOM: Unsupported Legacy Mode API.');
371 }
372 if (__DEV__) {
373 console.error(
374 - 'ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported ' +
375 - 'in React 18. Consider using a portal instead. Until you switch to ' +
374 + 'ReactDOM.unstable_renderSubtreeIntoContainer() has not been supported ' +
375 + 'since React 18. Consider using a portal instead. Until you switch to ' +
376 "the createRoot API, your app will behave as if it's running React " +
377 '17. Learn more: https://react.dev/link/switch-to-createroot',
378 );
@@ -399,7 +399,7 @@ export function unmountComponentAtNode(container: Container): boolean {
399 if (disableLegacyMode) {
400 if (__DEV__) {
401 console.error(
402 - 'unmountComponentAtNode is no longer supported in React 18. Use root.unmount() instead.',
402 + 'unmountComponentAtNode was removed in React 19. Use root.unmount() instead.',
403 );
404 }
405 throw new Error('ReactDOM: Unsupported Legacy Mode API.');
packages/react-reconciler/src/ReactFiberBeginWork.js
+1 -1
@@ -1975,7 +1975,7 @@ function mountIndeterminateComponent(
1975 if (__DEV__) {
1976 if (disableLegacyContext && Component.contextTypes) {
1977 console.error(
1978 - '%s uses the legacy contextTypes API which is no longer supported. ' +
1978 + '%s uses the legacy contextTypes API which was removed in React 19. ' +
1979 'Use React.createContext() with React.useContext() instead.',
1980 getComponentNameFromType(Component) || 'Unknown',
1981 );
packages/react-reconciler/src/ReactFiberClassComponent.js
+2 -2
@@ -413,14 +413,14 @@ function checkClassInstance(workInProgress: Fiber, ctor: any, newProps: any) {
413 if (disableLegacyContext) {
414 if (ctor.childContextTypes) {
415 console.error(
416 - '%s uses the legacy childContextTypes API which is no longer supported. ' +
416 + '%s uses the legacy childContextTypes API which was removed in React 19. ' +
417 'Use React.createContext() instead.',
418 name,
419 );
420 }
421 if (ctor.contextTypes) {
422 console.error(
423 - '%s uses the legacy contextTypes API which is no longer supported. ' +
423 + '%s uses the legacy contextTypes API which was removed in React 19. ' +
424 'Use React.createContext() with static contextType instead.',
425 name,
426 );
packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js
+2 -2
@@ -1785,8 +1785,8 @@ describe('ReactIncrementalErrorHandling', () => {
1785 ...gate(flags =>
1786 flags.disableLegacyContext
1787 ? [
1788 - 'Warning: Provider uses the legacy childContextTypes API which is no longer supported. Use React.createContext() instead.',
1789 - 'Warning: Provider uses the legacy childContextTypes API which is no longer supported. Use React.createContext() instead.',
1788 + 'Warning: Provider uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead.',
1789 + 'Warning: Provider uses the legacy childContextTypes API which was removed in React 19. Use React.createContext() instead.',
1790 ]
1791 : [],
1792 ),
packages/react-server/src/ReactFizzClassComponent.js
+2 -2
@@ -371,14 +371,14 @@ function checkClassInstance(instance: any, ctor: any, newProps: any) {
371 if (disableLegacyContext) {
372 if (ctor.childContextTypes) {
373 console.error(
374 - '%s uses the legacy childContextTypes API which is no longer supported. ' +
374 + '%s uses the legacy childContextTypes API which was removed in React 19. ' +
375 'Use React.createContext() instead.',
376 name,
377 );
378 }
379 if (ctor.contextTypes) {
380 console.error(
381 - '%s uses the legacy contextTypes API which is no longer supported. ' +
381 + '%s uses the legacy contextTypes API which was removed in React 19. ' +
382 'Use React.createContext() with static contextType instead.',
383 name,
384 );
packages/react-server/src/ReactFizzServer.js
+1 -1
@@ -1502,7 +1502,7 @@ function renderIndeterminateComponent(
1502 if (__DEV__) {
1503 if (disableLegacyContext && Component.contextTypes) {
1504 console.error(
1505 - '%s uses the legacy contextTypes API which is no longer supported. ' +
1505 + '%s uses the legacy contextTypes API which was removed in React 19. ' +
1506 'Use React.createContext() with React.useContext() instead.',
1507 getComponentNameFromType(Component) || 'Unknown',
1508 );
packages/react/src/__tests__/ReactCreateElement-test.js
+1 -1
@@ -181,7 +181,7 @@ describe('ReactCreateElement', () => {
181 expect(element.type).toBe(ComponentClass);
182 if (gate(flags => flags.enableRefAsProp)) {
183 expect(() => expect(element.ref).toBe(ref)).toErrorDev(
184 - 'Accessing element.ref is no longer supported',
184 + 'Accessing element.ref was removed in React 19',
185 {withoutStack: true},
186 );
187 const expectation = {foo: '56', ref};
packages/react/src/__tests__/ReactElementClone-test.js
+1 -1
@@ -361,7 +361,7 @@ describe('ReactElementClone', () => {
361 if (gate(flags => flags.enableRefAsProp)) {
362 expect(clone.props.ref).toBe('34');
363 expect(() => expect(clone.ref).toBe('34')).toErrorDev(
364 - 'Accessing element.ref is no longer supported',
364 + 'Accessing element.ref was removed in React 19',
365 {withoutStack: true},
366 );
367 expect(clone.props).toEqual({foo: 'ef', ref: '34'});
packages/react/src/__tests__/ReactJSXTransformIntegration-test.js
+1 -1
@@ -126,7 +126,7 @@ describe('ReactJSXTransformIntegration', () => {
126 expect(element.type).toBe(Component);
127 if (gate(flags => flags.enableRefAsProp)) {
128 expect(() => expect(element.ref).toBe(ref)).toErrorDev(
129 - 'Accessing element.ref is no longer supported',
129 + 'Accessing element.ref was removed in React 19',
130 {withoutStack: true},
131 );
132 const expectation = {foo: '56', ref};
packages/react/src/jsx/ReactJSXElement.js
+1 -1
@@ -141,7 +141,7 @@ function elementRefGetterWithDeprecationWarning() {
141 if (!didWarnAboutElementRef[componentName]) {
142 didWarnAboutElementRef[componentName] = true;
143 console.error(
144 - 'Accessing element.ref is no longer supported. ref is now a ' +
144 + 'Accessing element.ref was removed in React 19. ref is now a ' +
145 'regular prop. It will be removed from the JSX Element ' +
146 'type in a future release.',
147 );
scripts/jest/shouldIgnoreConsoleError.js
+6 -3
@@ -17,10 +17,13 @@ module.exports = function shouldIgnoreConsoleError(
17 return true;
18 }
19 if (
20 - format.indexOf('ReactDOM.render is no longer supported in React 18') !==
21 - -1 ||
20 + format.indexOf('ReactDOM.render was removed in React 19') !== -1 ||
21 + format.indexOf('ReactDOM.hydrate was removed in React 19') !== -1 ||
22 format.indexOf(
23 - 'ReactDOM.hydrate is no longer supported in React 18'
23 + 'ReactDOM.render has not been supported since React 18'
24 + ) !== -1 ||
25 + format.indexOf(
26 + 'ReactDOM.hydrate has not been supported since React 18'
27 ) !== -1
28 ) {
29 // We haven't finished migrating our tests to use createRoot.