From 3601fb402c5d34d75ee211ef04eb900ac404c68e Mon Sep 17 00:00:00 2001 From: "Sharon (Sean) Rolel" Date: Thu, 16 Apr 2020 20:56:59 -0400 Subject: [PATCH] Do not throw when getChildContext is not defined It's a weird use-case, but this doesn't throw in React 15. --- src/render/context.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/context.js b/src/render/context.js index aa6cb0b..7430999 100644 --- a/src/render/context.js +++ b/src/render/context.js @@ -20,7 +20,7 @@ const EMPTY_CONTEXT = Object.freeze({}); * @return {Object} Child context merged into master context. */ function getChildContext (componentPrototype, instance, context) { - if (componentPrototype.childContextTypes) { + if (componentPrototype.childContextTypes && instance.getChildContext) { return assign(Object.create(null), context, instance.getChildContext()); } return context;