Skip to content

Commit 4144715

Browse files
authored
Fix React version check to support 16.10 (#1407)
* Fix React version check to support 16.10 Since `parseFloat(React.version)` resolves to `16.1`, that breaks our version check. So, I've switched to checking against the `forwardRef` API's existence, which was also added in 16.3. * Also fix the version check in connectAdvanced.
1 parent 9137f7f commit 4144715

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/components/Provider.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
33
import { storeShape, subscriptionShape } from '../utils/PropTypes'
44
import warning from '../utils/warning'
55

6-
const prefixUnsafeLifecycleMethods = parseFloat(React.version) >= 16.3
6+
const prefixUnsafeLifecycleMethods = typeof React.forwardRef !== "undefined"
77

88
let didWarnAboutReceivingStore = false
99
function warnAboutReceivingStore() {

src/components/connectAdvanced.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { isValidElementType } from 'react-is'
66
import Subscription from '../utils/Subscription'
77
import { storeShape, subscriptionShape } from '../utils/PropTypes'
88

9-
const prefixUnsafeLifecycleMethods = parseFloat(React.version) >= 16.3
9+
const prefixUnsafeLifecycleMethods = typeof React.forwardRef !== "undefined"
1010

1111
let hotReloadingVersion = 0
1212
const dummyState = {}

0 commit comments

Comments
 (0)