Backwards compat fix for ReactCurrentDispatcher on older react versions (#14770)
* Add current owner ref fallback for newer renderers with older react versions * Replaced current owner forward with current:null
Brian Vaughn committed
Feb 6, 2019 at 17:02 UTC
f2e2637c8e351611dc012bba646431feb250a3e8
1 file changed
+9
packages/shared/ReactSharedInternals.js
+9
@@ -10,4 +10,13 @@ import React from 'react';
10
const ReactSharedInternals =
11
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
12
13
+// Prevent newer renderers from RTE when used with older react package versions.
14
+// Current owner and dispatcher used to share the same ref,
15
+// but PR #14548 split them out to better support the react-debug-tools package.
16
+if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
17
+ ReactSharedInternals.ReactCurrentDispatcher = {
18
+ current: null,
19
+ };
20
+}
21
+
22
export default ReactSharedInternals;