mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
Rename 17 to 18 in warnings (#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.
This commit is contained in:
parent
86b4070ddb
commit
4985bb0a80
|
|
@ -27,6 +27,6 @@ export {
|
|||
unstable_renderSubtreeIntoContainer,
|
||||
// Disabled behind disableUnstableCreatePortal
|
||||
// Temporary alias since we already shipped React 16 RC with it.
|
||||
// TODO: remove in React 17.
|
||||
// TODO: remove in React 18.
|
||||
unstable_createPortal,
|
||||
} from './src/client/ReactDOM';
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ export {
|
|||
unmountComponentAtNode,
|
||||
unstable_renderSubtreeIntoContainer,
|
||||
// Temporary alias since we already shipped React 16 RC with it.
|
||||
// TODO: remove in React 17.
|
||||
// TODO: remove in React 18.
|
||||
unstable_createPortal,
|
||||
} from './src/client/ReactDOM';
|
||||
|
|
|
|||
|
|
@ -1386,20 +1386,20 @@ describe('ReactComponentLifeCycle', () => {
|
|||
`Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
|
||||
|
||||
* Move code with side effects to componentDidMount, and set initial state in the constructor.
|
||||
* 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.
|
||||
* 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.
|
||||
|
||||
Please update the following components: MyComponent`,
|
||||
`Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
|
||||
|
||||
* Move data fetching code or side effects to componentDidUpdate.
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
|
||||
Please update the following components: MyComponent`,
|
||||
`Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
|
||||
|
||||
* Move data fetching code or side effects to componentDidUpdate.
|
||||
* 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.
|
||||
* 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.
|
||||
|
||||
Please update the following components: MyComponent`,
|
||||
/* eslint-enable max-len */
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ describe('ReactCompositeComponent', () => {
|
|||
ReactDOM.render(<Parent />, container),
|
||||
).toWarnDev(
|
||||
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
|
||||
'will stop working in React v17. Replace the ReactDOM.render() call ' +
|
||||
'will stop working in React v18. Replace the ReactDOM.render() call ' +
|
||||
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
|
||||
{withoutStack: true},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ describe('ReactDOMFiber', () => {
|
|||
expect(container.innerHTML).toBe('');
|
||||
});
|
||||
|
||||
// TODO: remove in React 17
|
||||
// TODO: remove in React 18
|
||||
if (!__EXPERIMENTAL__) {
|
||||
it('should support unstable_createPortal alias', () => {
|
||||
const portalContainer = document.createElement('div');
|
||||
|
|
@ -260,7 +260,7 @@ describe('ReactDOMFiber', () => {
|
|||
),
|
||||
).toWarnDev(
|
||||
'The ReactDOM.unstable_createPortal() alias has been deprecated, ' +
|
||||
'and will be removed in React 17+. Update your code to use ' +
|
||||
'and will be removed in React 18+. Update your code to use ' +
|
||||
'ReactDOM.createPortal() instead. It has the exact same API, ' +
|
||||
'but without the "unstable_" prefix.',
|
||||
{withoutStack: true},
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ describe('rendering React components at document', () => {
|
|||
callback,
|
||||
).toWarnDev(
|
||||
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
|
||||
'will stop working in React v17. Replace the ReactDOM.render() call ' +
|
||||
'will stop working in React v18. Replace the ReactDOM.render() call ' +
|
||||
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
|
||||
{withoutStack: true},
|
||||
);
|
||||
|
|
@ -201,7 +201,7 @@ describe('rendering React components at document', () => {
|
|||
ReactDOM.render(<Component text="Hello world" />, testDocument),
|
||||
).toWarnDev(
|
||||
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
|
||||
'will stop working in React v17. Replace the ReactDOM.render() call ' +
|
||||
'will stop working in React v18. Replace the ReactDOM.render() call ' +
|
||||
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
|
||||
{withoutStack: true},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ describe('ReactDOMServerHydration', () => {
|
|||
instance = ReactDOM.render(<TestComponent name="x" />, element);
|
||||
}).toWarnDev(
|
||||
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
|
||||
'will stop working in React v17. Replace the ReactDOM.render() call ' +
|
||||
'will stop working in React v18. Replace the ReactDOM.render() call ' +
|
||||
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
|
||||
{withoutStack: true},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ it('should warn in legacy mode', () => {
|
|||
expect(() => {
|
||||
ReactDOM.render(<App />, document.createElement('div'));
|
||||
}).toErrorDev(
|
||||
['Starting from React v17, the "scheduler" module will need to be mocked'],
|
||||
['Starting from React v18, the "scheduler" module will need to be mocked'],
|
||||
{withoutStack: true},
|
||||
);
|
||||
// does not warn twice
|
||||
|
|
|
|||
4
packages/react-dom/src/client/ReactDOM.js
vendored
4
packages/react-dom/src/client/ReactDOM.js
vendored
|
|
@ -164,7 +164,7 @@ function unstable_createPortal(
|
|||
didWarnAboutUnstableCreatePortal = true;
|
||||
console.warn(
|
||||
'The ReactDOM.unstable_createPortal() alias has been deprecated, ' +
|
||||
'and will be removed in React 17+. Update your code to use ' +
|
||||
'and will be removed in React 18+. Update your code to use ' +
|
||||
'ReactDOM.createPortal() instead. It has the exact same API, ' +
|
||||
'but without the "unstable_" prefix.',
|
||||
);
|
||||
|
|
@ -210,7 +210,7 @@ export {
|
|||
renderSubtreeIntoContainer as unstable_renderSubtreeIntoContainer,
|
||||
// Disabled behind disableUnstableCreatePortal
|
||||
// Temporary alias since we already shipped React 16 RC with it.
|
||||
// TODO: remove in React 17.
|
||||
// TODO: remove in React 18.
|
||||
unstable_createPortal,
|
||||
// enableCreateEventHandleAPI
|
||||
createEventHandle as unstable_createEventHandle,
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ function legacyCreateRootFromDOMContainer(
|
|||
warnedAboutHydrateAPI = true;
|
||||
console.warn(
|
||||
'render(): Calling ReactDOM.render() to hydrate server-rendered markup ' +
|
||||
'will stop working in React v17. Replace the ReactDOM.render() call ' +
|
||||
'will stop working in React v18. Replace the ReactDOM.render() call ' +
|
||||
'with ReactDOM.hydrate() if you want React to attach to the server HTML.',
|
||||
);
|
||||
}
|
||||
|
|
|
|||
4
packages/react-is/src/ReactIs.js
vendored
4
packages/react-is/src/ReactIs.js
vendored
|
|
@ -84,7 +84,7 @@ export function isAsyncMode(object: any) {
|
|||
// Using console['warn'] to evade Babel and ESLint
|
||||
console['warn'](
|
||||
'The ReactIs.isAsyncMode() alias has been deprecated, ' +
|
||||
'and will be removed in React 17+.',
|
||||
'and will be removed in React 18+.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ export function isConcurrentMode(object: any) {
|
|||
// Using console['warn'] to evade Babel and ESLint
|
||||
console['warn'](
|
||||
'The ReactIs.isConcurrentMode() alias has been deprecated, ' +
|
||||
'and will be removed in React 17+.',
|
||||
'and will be removed in React 18+.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3141,7 +3141,7 @@ export function warnIfUnmockedScheduler(fiber: Fiber) {
|
|||
} else if (warnAboutUnmockedScheduler === true) {
|
||||
didWarnAboutUnmockedScheduler = true;
|
||||
console.error(
|
||||
'Starting from React v17, the "scheduler" module will need to be mocked ' +
|
||||
'Starting from React v18, the "scheduler" module will need to be mocked ' +
|
||||
'to guarantee consistent behaviour across tests and browsers. ' +
|
||||
'For example, with jest: \n' +
|
||||
// Break up requires to avoid accidentally parsing them as dependencies.
|
||||
|
|
|
|||
|
|
@ -3310,7 +3310,7 @@ export function warnIfUnmockedScheduler(fiber: Fiber) {
|
|||
} else if (warnAboutUnmockedScheduler === true) {
|
||||
didWarnAboutUnmockedScheduler = true;
|
||||
console.error(
|
||||
'Starting from React v17, the "scheduler" module will need to be mocked ' +
|
||||
'Starting from React v18, the "scheduler" module will need to be mocked ' +
|
||||
'to guarantee consistent behaviour across tests and browsers. ' +
|
||||
'For example, with jest: \n' +
|
||||
// Break up requires to avoid accidentally parsing them as dependencies.
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ if (__DEV__) {
|
|||
'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
|
||||
'* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' +
|
||||
'* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' +
|
||||
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
|
||||
'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.\n' +
|
||||
'\nPlease update the following components: %s',
|
||||
|
|
@ -260,7 +260,7 @@ if (__DEV__) {
|
|||
'code to use memoization techniques or move it to ' +
|
||||
'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' +
|
||||
'* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' +
|
||||
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
|
||||
'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.\n' +
|
||||
'\nPlease update the following components: %s',
|
||||
|
|
@ -276,7 +276,7 @@ if (__DEV__) {
|
|||
'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
|
||||
'* Move data fetching code or side effects to componentDidUpdate.\n' +
|
||||
'* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' +
|
||||
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
|
||||
'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.\n' +
|
||||
'\nPlease update the following components: %s',
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ if (__DEV__) {
|
|||
'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
|
||||
'* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' +
|
||||
'* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' +
|
||||
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
|
||||
'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.\n' +
|
||||
'\nPlease update the following components: %s',
|
||||
|
|
@ -260,7 +260,7 @@ if (__DEV__) {
|
|||
'code to use memoization techniques or move it to ' +
|
||||
'static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state\n' +
|
||||
'* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' +
|
||||
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
|
||||
'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.\n' +
|
||||
'\nPlease update the following components: %s',
|
||||
|
|
@ -276,7 +276,7 @@ if (__DEV__) {
|
|||
'See https://fb.me/react-unsafe-component-lifecycles for details.\n\n' +
|
||||
'* Move data fetching code or side effects to componentDidUpdate.\n' +
|
||||
'* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' +
|
||||
'this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. ' +
|
||||
'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.\n' +
|
||||
'\nPlease update the following components: %s',
|
||||
|
|
|
|||
|
|
@ -487,20 +487,20 @@ Please update the following components: AsyncRoot`,
|
|||
`Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
|
||||
|
||||
* Move code with side effects to componentDidMount, and set initial state in the constructor.
|
||||
* 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.
|
||||
* 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.
|
||||
|
||||
Please update the following components: Parent`,
|
||||
`Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
|
||||
|
||||
* Move data fetching code or side effects to componentDidUpdate.
|
||||
* 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
|
||||
* 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.
|
||||
* 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.
|
||||
|
||||
Please update the following components: Parent`,
|
||||
`Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.
|
||||
|
||||
* Move data fetching code or side effects to componentDidUpdate.
|
||||
* 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.
|
||||
* 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.
|
||||
|
||||
Please update the following components: Parent`,
|
||||
/* eslint-enable max-len */
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ export const enableCreateEventHandleAPI = false;
|
|||
|
||||
// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
||||
|
||||
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
||||
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v18?)
|
||||
// Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
|
||||
export const warnAboutUnmockedScheduler = false;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user