Skip to content

Commit 892dd52

Browse files
committed
Improve component type check in getComponentKey (cherry-pick facebook#9464)
1 parent 2e982b9 commit 892dd52

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/isomorphic/children/ReactChildren.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ var didWarnAboutMaps = false;
4949
function getComponentKey(component, index) {
5050
// Do some typechecking here since we call this blindly. We want to ensure
5151
// that we don't block potential future ES APIs.
52-
if (component && typeof component === 'object' && component.key != null) {
52+
if (
53+
typeof component === 'object' && component !== null && component.key != null
54+
) {
5355
// Explicit key
5456
return KeyEscapeUtils.escape(component.key);
5557
}

0 commit comments

Comments
 (0)