From 32ae1a52e4e09b6e2ac87ee9f7f891a08f2f043c Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Thu, 12 Dec 2019 23:51:37 +0800 Subject: [PATCH] fix: render components should include memo/forwardRef (#1764) --- src/utils.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 58d29ff..bd40169 100755 --- a/src/utils.js +++ b/src/utils.js @@ -237,8 +237,20 @@ function isFunctionComponent(component) { return typeof component === 'function' } +function isExoticComponent(component) { + return ( + typeof component === 'object' && + typeof component.$$typeof === 'symbol' && + ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description) + ) +} + function isReactComponent(component) { - return isClassComponent(component) || isFunctionComponent(component) + return ( + isClassComponent(component) || + isFunctionComponent(component) || + isExoticComponent(component) + ) } export function isFunction(a) {