Skip to content

Commit ec06935

Browse files
authored
Merge pull request #7 from lllllllqw/support-react-17
support react 17
2 parents af1dc99 + 420ee3f commit ec06935

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/magicSelf.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ export const MAGIC_STACKS = Symbol.for('magicStacks');
2020

2121
const ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2222

23+
const isReact15 = React.version.indexOf('15') === 0
24+
2325
// React 15.3.2 support + Polyfill
24-
const instanceKey = React.version.indexOf('16') === 0 ? 'stateNode' : '_instance';
26+
const instanceKey = isReact15 ? '_instance' : 'stateNode';
2527

26-
if (React.version.indexOf('15') === 0) {
28+
if (isReact15) {
2729
invariant(
2830
ReactInternals,
2931
'Please for React ^15.3.2 - 15.6.2 import "react-class-hooks/poly15" in your root index.js!'

0 commit comments

Comments
 (0)