Skip to content

Commit 1df69a1

Browse files
committed
better __proto__ detection
1 parent e2acd51 commit 1df69a1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/component.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ function Component(props, context) {
4242

4343
Component.prototype = Object.create(React.Component.prototype);
4444

45-
if ('__proto__' in {}) {
46-
Component.__proto__ = React.Component;
47-
} else if (typeof Object.setPrototypeOf === 'function') {
45+
if (typeof Object.setPrototypeOf === 'function') {
4846
Object.setPrototypeOf(Component, React.Component);
47+
} else if (Object.__proto__) {
48+
Component.__proto__ = React.Component;
4949
} else {
5050
assign(Component, React.Component);
5151
}

0 commit comments

Comments
 (0)