Skip to content

Commit 8f41e98

Browse files
committed
Add ctx._context for backwards compat
1 parent 056d631 commit 8f41e98

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/react/src/ReactContext.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export function createContext<T>(defaultValue: T): ReactContext<T> {
3030
// These are circular
3131
Provider: (null: any),
3232
Consumer: (null: any),
33+
// Temporary for backwards compat:
34+
_context: null,
3335
};
3436

3537
context.Provider = context;
@@ -38,6 +40,10 @@ export function createContext<T>(defaultValue: T): ReactContext<T> {
3840
_context: context,
3941
};
4042

43+
// Some tooling (e.g. DevTools) may assume that context.Provider._context === context.
44+
// Keep that true for now to avoid excessive breakage.
45+
context._context = context;
46+
4147
if (__DEV__) {
4248
context._currentRenderer = null;
4349
context._currentRenderer2 = null;

0 commit comments

Comments
 (0)