From 82bdc8bf7b52f7651bde093323a2520b4100bf7e Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Tue, 13 Apr 2021 16:51:27 -0400 Subject: [PATCH] Implement reader in class --- packages/react-server/src/ReactFizzClassComponent.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/react-server/src/ReactFizzClassComponent.js b/packages/react-server/src/ReactFizzClassComponent.js index d56bc633b8498..a7385d54aa781 100644 --- a/packages/react-server/src/ReactFizzClassComponent.js +++ b/packages/react-server/src/ReactFizzClassComponent.js @@ -8,6 +8,7 @@ */ import {emptyContextObject} from './ReactFizzContext'; +import {readContext} from './ReactFizzNewContext'; import {disableLegacyContext} from 'shared/ReactFeatureFlags'; import {get as getInstance, set as setInstance} from 'shared/ReactInstanceMap'; @@ -211,9 +212,7 @@ export function constructClassInstance( } if (typeof contextType === 'object' && contextType !== null) { - // TODO: Implement Context. - // context = readContext((contextType: any)); - throw new Error('Context is not yet implemented.'); + context = readContext((contextType: any)); } else if (!disableLegacyContext) { context = maskedLegacyContext; } @@ -617,9 +616,7 @@ export function mountClassInstance( const contextType = ctor.contextType; if (typeof contextType === 'object' && contextType !== null) { - // TODO: Implement Context. - // instance.context = readContext(contextType); - throw new Error('Context is not yet implemented.'); + instance.context = readContext(contextType); } else if (disableLegacyContext) { instance.context = emptyContextObject; } else {