Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4985bb0

Browse files
authored
Rename 17 to 18 in warnings (facebook#19031)
We're not really supposed to refer to future versions by numbers. These will all slip so these numbers don't make sense anymore.
1 parent 86b4070 commit 4985bb0

17 files changed

+29
-29
lines changed

packages/react-dom/index.experimental.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ export {
2727
unstable_renderSubtreeIntoContainer,
2828
// Disabled behind disableUnstableCreatePortal
2929
// Temporary alias since we already shipped React 16 RC with it.
30-
// TODO: remove in React 17.
30+
// TODO: remove in React 18.
3131
unstable_createPortal,
3232
} from './src/client/ReactDOM';

packages/react-dom/index.stable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ export {
1919
unmountComponentAtNode,
2020
unstable_renderSubtreeIntoContainer,
2121
// Temporary alias since we already shipped React 16 RC with it.
22-
// TODO: remove in React 17.
22+
// TODO: remove in React 18.
2323
unstable_createPortal,
2424
} from './src/client/ReactDOM';

packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,20 +1386,20 @@ describe('ReactComponentLifeCycle', () => {
13861386
`Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
13871387
13881388
* Move code with side effects to componentDidMount, and set initial state in the constructor.
1389-
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
1389+
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
13901390
13911391
Please update the following components: MyComponent`,
13921392
`Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
13931393
13941394
* Move data fetching code or side effects to componentDidUpdate.
13951395
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
1396-
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
1396+
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
13971397
13981398
Please update the following components: MyComponent`,
13991399
`Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
14001400
14011401
* Move data fetching code or side effects to componentDidUpdate.
1402-
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
1402+
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
14031403
14041404
Please update the following components: MyComponent`,
14051405
/* eslint-enable max-len */

packages/react-dom/src/__tests__/ReactCompositeComponent-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ describe('ReactCompositeComponent', () => {
196196
ReactDOM.render(<Parent />, container),
197197
).toWarnDev(
198198
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
199-
'will stop working in React v17. Replace the ReactDOM.render() call ' +
199+
'will stop working in React v18. Replace the ReactDOM.render() call ' +
200200
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
201201
{withoutStack: true},
202202
);

packages/react-dom/src/__tests__/ReactDOMFiber-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ describe('ReactDOMFiber', () => {
246246
expect(container.innerHTML).toBe('');
247247
});
248248

249-
// TODO: remove in React 17
249+
// TODO: remove in React 18
250250
if (!__EXPERIMENTAL__) {
251251
it('should support unstable_createPortal alias', () => {
252252
const portalContainer = document.createElement('div');
@@ -260,7 +260,7 @@ describe('ReactDOMFiber', () => {
260260
),
261261
).toWarnDev(
262262
'The ReactDOM.unstable_createPortal() alias has been deprecated, ' +
263-
'and will be removed in React 17+. Update your code to use ' +
263+
'and will be removed in React 18+. Update your code to use ' +
264264
'ReactDOM.createPortal() instead. It has the exact same API, ' +
265265
'but without the "unstable_" prefix.',
266266
{withoutStack: true},

packages/react-dom/src/__tests__/ReactRenderDocument-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('rendering React components at document', () => {
3939
callback,
4040
).toWarnDev(
4141
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
42-
'will stop working in React v17. Replace the ReactDOM.render() call ' +
42+
'will stop working in React v18. Replace the ReactDOM.render() call ' +
4343
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
4444
{withoutStack: true},
4545
);
@@ -201,7 +201,7 @@ describe('rendering React components at document', () => {
201201
ReactDOM.render(<Component text="Hello world" />, testDocument),
202202
).toWarnDev(
203203
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
204-
'will stop working in React v17. Replace the ReactDOM.render() call ' +
204+
'will stop working in React v18. Replace the ReactDOM.render() call ' +
205205
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
206206
{withoutStack: true},
207207
);

packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe('ReactDOMServerHydration', () => {
8383
instance = ReactDOM.render(<TestComponent name="x" />, element);
8484
}).toWarnDev(
8585
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
86-
'will stop working in React v17. Replace the ReactDOM.render() call ' +
86+
'will stop working in React v18. Replace the ReactDOM.render() call ' +
8787
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
8888
{withoutStack: true},
8989
);

packages/react-dom/src/__tests__/ReactUnmockedSchedulerWarning-test.internal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ it('should warn in legacy mode', () => {
3232
expect(() => {
3333
ReactDOM.render(<App />, document.createElement('div'));
3434
}).toErrorDev(
35-
['Starting from React v17, the "scheduler" module will need to be mocked'],
35+
['Starting from React v18, the "scheduler" module will need to be mocked'],
3636
{withoutStack: true},
3737
);
3838
// does not warn twice

packages/react-dom/src/client/ReactDOM.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function unstable_createPortal(
164164
didWarnAboutUnstableCreatePortal = true;
165165
console.warn(
166166
'The ReactDOM.unstable_createPortal() alias has been deprecated, ' +
167-
'and will be removed in React 17+. Update your code to use ' +
167+
'and will be removed in React 18+. Update your code to use ' +
168168
'ReactDOM.createPortal() instead. It has the exact same API, ' +
169169
'but without the "unstable_" prefix.',
170170
);
@@ -210,7 +210,7 @@ export {
210210
renderSubtreeIntoContainer as unstable_renderSubtreeIntoContainer,
211211
// Disabled behind disableUnstableCreatePortal
212212
// Temporary alias since we already shipped React 16 RC with it.
213-
// TODO: remove in React 17.
213+
// TODO: remove in React 18.
214214
unstable_createPortal,
215215
// enableCreateEventHandleAPI
216216
createEventHandle as unstable_createEventHandle,

packages/react-dom/src/client/ReactDOMLegacy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function legacyCreateRootFromDOMContainer(
143143
warnedAboutHydrateAPI = true;
144144
console.warn(
145145
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
146-
'will stop working in React v17. Replace the ReactDOM.render() call ' +
146+
'will stop working in React v18. Replace the ReactDOM.render() call ' +
147147
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
148148
);
149149
}

packages/react-is/src/ReactIs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export function isAsyncMode(object: any) {
8484
// Using console['warn'] to evade Babel and ESLint
8585
console['warn'](
8686
'The ReactIs.isAsyncMode() alias has been deprecated, ' +
87-
'and will be removed in React 17+.',
87+
'and will be removed in React 18+.',
8888
);
8989
}
9090
}
@@ -97,7 +97,7 @@ export function isConcurrentMode(object: any) {
9797
// Using console['warn'] to evade Babel and ESLint
9898
console['warn'](
9999
'The ReactIs.isConcurrentMode() alias has been deprecated, ' +
100-
'and will be removed in React 17+.',
100+
'and will be removed in React 18+.',
101101
);
102102
}
103103
}

packages/react-reconciler/src/ReactFiberWorkLoop.new.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3141,7 +3141,7 @@ export function warnIfUnmockedScheduler(fiber: Fiber) {
31413141
} else if (warnAboutUnmockedScheduler === true) {
31423142
didWarnAboutUnmockedScheduler = true;
31433143
console.error(
3144-
'Starting from React v17, the "scheduler" module will need to be mocked ' +
3144+
'Starting from React v18, the "scheduler" module will need to be mocked ' +
31453145
'to guarantee consistent behaviour across tests and browsers. ' +
31463146
'For example, with jest: \n' +
31473147
// Break up requires to avoid accidentally parsing them as dependencies.

packages/react-reconciler/src/ReactFiberWorkLoop.old.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3310,7 +3310,7 @@ export function warnIfUnmockedScheduler(fiber: Fiber) {
33103310
} else if (warnAboutUnmockedScheduler === true) {
33113311
didWarnAboutUnmockedScheduler = true;
33123312
console.error(
3313-
'Starting from React v17, the "scheduler" module will need to be mocked ' +
3313+
'Starting from React v18, the "scheduler" module will need to be mocked ' +
33143314
'to guarantee consistent behaviour across tests and browsers. ' +
33153315
'For example, with jest: \n' +
33163316
// Break up requires to avoid accidentally parsing them as dependencies.

packages/react-reconciler/src/ReactStrictModeWarnings.new.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ if (__DEV__) {
239239
'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
240240
'* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' +
241241
'* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' +
242-
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
242+
'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' +
243243
'To rename all deprecated lifecycles to their new names, you can run ' +
244244
'`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' +
245245
'\nPlease update the following components: %s',
@@ -260,7 +260,7 @@ if (__DEV__) {
260260
'code to use memoization techniques or move it to ' +
261261
'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' +
262262
'* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' +
263-
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
263+
'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' +
264264
'To rename all deprecated lifecycles to their new names, you can run ' +
265265
'`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' +
266266
'\nPlease update the following components: %s',
@@ -276,7 +276,7 @@ if (__DEV__) {
276276
'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
277277
'* Move data fetching code or side effects to componentDidUpdate.\n' +
278278
'* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' +
279-
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
279+
'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' +
280280
'To rename all deprecated lifecycles to their new names, you can run ' +
281281
'`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' +
282282
'\nPlease update the following components: %s',

packages/react-reconciler/src/ReactStrictModeWarnings.old.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ if (__DEV__) {
239239
'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
240240
'* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' +
241241
'* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' +
242-
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
242+
'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' +
243243
'To rename all deprecated lifecycles to their new names, you can run ' +
244244
'`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' +
245245
'\nPlease update the following components: %s',
@@ -260,7 +260,7 @@ if (__DEV__) {
260260
'code to use memoization techniques or move it to ' +
261261
'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' +
262262
'* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' +
263-
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
263+
'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' +
264264
'To rename all deprecated lifecycles to their new names, you can run ' +
265265
'`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' +
266266
'\nPlease update the following components: %s',
@@ -276,7 +276,7 @@ if (__DEV__) {
276276
'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
277277
'* Move data fetching code or side effects to componentDidUpdate.\n' +
278278
'* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' +
279-
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
279+
'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' +
280280
'To rename all deprecated lifecycles to their new names, you can run ' +
281281
'`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' +
282282
'\nPlease update the following components: %s',

packages/react/src/__tests__/ReactStrictMode-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,20 +487,20 @@ Please update the following components: AsyncRoot`,
487487
`Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
488488
489489
* Move code with side effects to componentDidMount, and set initial state in the constructor.
490-
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
490+
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
491491
492492
Please update the following components: Parent`,
493493
`Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
494494
495495
* Move data fetching code or side effects to componentDidUpdate.
496496
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
497-
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
497+
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
498498
499499
Please update the following components: Parent`,
500500
`Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
501501
502502
* Move data fetching code or side effects to componentDidUpdate.
503-
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
503+
* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
504504
505505
Please update the following components: Parent`,
506506
/* eslint-enable max-len */

packages/shared/ReactFeatureFlags.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const enableCreateEventHandleAPI = false;
6262

6363
// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
6464

65-
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
65+
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v18?)
6666
// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
6767
export const warnAboutUnmockedScheduler = false;
6868

0 commit comments

Comments
 (0)