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
This commit is contained in:
Brian Vaughn 2019-02-06 17:02:14 +00:00 committed by GitHub
parent 1107b9673c
commit f2e2637c8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -10,4 +10,13 @@ import React from 'react';
const ReactSharedInternals =
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
// Prevent newer renderers from RTE when used with older react package versions.
// Current owner and dispatcher used to share the same ref,
// but PR #14548 split them out to better support the react-debug-tools package.
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
ReactSharedInternals.ReactCurrentDispatcher = {
current: null,
};
}
export default ReactSharedInternals;