Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
acdlite committed Oct 19, 2018
1 parent 71f1677 commit 4b2b017
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/react-cache/src/ReactCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ const Pending = 0;
const Resolved = 1;
const Rejected = 2;

const currentOwner =
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;

function readContext(Context, observedBits) {
const dispatcher =
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner
.currentDispatcher;
const dispatcher = currentOwner.currentDispatcher;
if (dispatcher === null) {
throw new Error(
'react-cache: read and preload may only be called from within a ' +
"component's render. They are not supported in event handlers or " +
'life-cycles.',
'lifecycle methods.',
);
}
return dispatcher.readContext(Context, observedBits);
Expand Down

0 comments on commit 4b2b017

Please sign in to comment.