main
js 24 lines 864 Bytes
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow
8 */
9
10 import reactDOMPackageVersion from 'shared/ReactVersion';
11 import * as IsomorphicReactPackage from 'react';
12
13 export function ensureCorrectIsomorphicReactVersion() {
14 const isomorphicReactPackageVersion = IsomorphicReactPackage.version;
15 if (isomorphicReactPackageVersion !== reactDOMPackageVersion) {
16 throw new Error(
17 'Incompatible React versions: The "react" and "react-dom" packages must ' +
18 'have the exact same version. Instead got:\n' +
19 ` - react: ${isomorphicReactPackageVersion}\n` +
20 ` - react-dom: ${reactDOMPackageVersion}\n` +
21 'Learn more: https://react.dev/warnings/version-mismatch',
22 );
23 }
24 }