Skip to content

Commit 87728c3

Browse files
committed
Add deprecation warning for ReactIs.isAsyncMode
1 parent 5d6d348 commit 87728c3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: packages/react-is/src/ReactIs.js

+13
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
REACT_STRICT_MODE_TYPE,
2222
} from 'shared/ReactSymbols';
2323
import isValidElementType from 'shared/isValidElementType';
24+
import lowPriorityWarning from 'shared/lowPriorityWarning';
2425

2526
export function typeOf(object: any) {
2627
if (typeof object === 'object' && object !== null) {
@@ -56,6 +57,8 @@ export function typeOf(object: any) {
5657
return undefined;
5758
}
5859

60+
// AsyncMode alias is deprecated along with isAsyncMode
61+
export const AsyncMode = REACT_CONCURRENT_MODE_TYPE;
5962
export const ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
6063
export const ContextConsumer = REACT_CONTEXT_TYPE;
6164
export const ContextProvider = REACT_PROVIDER_TYPE;
@@ -68,6 +71,16 @@ export const StrictMode = REACT_STRICT_MODE_TYPE;
6871

6972
export {isValidElementType};
7073

74+
// AsyncMode should be deprecated
75+
export function isAsyncMode(object: any) {
76+
lowPriorityWarning(
77+
false,
78+
'The ReactIs.isAsyncMode() alias has been deprecated, ' +
79+
'and will be removed in React 17+. Update your code to use ' +
80+
'ReactIs.isConcurrentMode() instead. It has the exact same API.'
81+
);
82+
return isConcurrentMode(object);
83+
}
7184
export function isConcurrentMode(object: any) {
7285
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
7386
}

0 commit comments

Comments
 (0)