diff --git a/packages/react/src/ReactContext.js b/packages/react/src/ReactContext.js index 5f4fc2585c2b7..3b1b2a583a7aa 100644 --- a/packages/react/src/ReactContext.js +++ b/packages/react/src/ReactContext.js @@ -30,6 +30,8 @@ export function createContext(defaultValue: T): ReactContext { // These are circular Provider: (null: any), Consumer: (null: any), + // Temporary for backwards compat: + _context: null, }; context.Provider = context; @@ -38,6 +40,10 @@ export function createContext(defaultValue: T): ReactContext { _context: context, }; + // Some tooling (e.g. DevTools) may assume that context.Provider._context === context. + // Keep that true for now to avoid excessive breakage. + context._context = context; + if (__DEV__) { context._currentRenderer = null; context._currentRenderer2 = null;