Skip to content
Prev Previous commit
Next Next commit
address feedback
  • Loading branch information
trueadm committed Oct 12, 2018
commit 22f4359b70bdaafc8d963f36275473fb24e938f0
12 changes: 5 additions & 7 deletions packages/react-reconciler/src/ReactFiberBeginWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

import type {ReactProviderType, ReactContext} from 'shared/ReactTypes';
import lowPriorityWarning from 'shared/lowPriorityWarning';
import type {Fiber} from 'react-reconciler/src/ReactFiber';
import type {FiberRoot} from './ReactFiberRoot';
import type {ExpirationTime} from './ReactFiberExpirationTime';
Expand Down Expand Up @@ -1113,18 +1112,17 @@ function updateContextConsumer(
// a property called "_context", which also gives us the ability to check
// in DEV mode if this property exists or not and warn if it does not.
if (__DEV__) {
if (workInProgress.type._context === undefined) {
if (context._context === undefined) {
if (!hasWarnedAboutUsingContextAsConsumer) {
hasWarnedAboutUsingContextAsConsumer = true;
lowPriorityWarning(
warning(
false,
'You are using the Context from React.createContext() as a consumer.' +
'The correct way is to use Context.Consumer as the consumer instead. ' +
'This usage is deprecated and will be removed in a future major release.',
'Rendering <Context> directly is not supported and will be removed in ' +
'a future major release. Did you mean to render <Context.Consumer> instead?',
);
}
} else {
context = workInProgress.type._context;
context = context._context;
}
}
const newProps = workInProgress.pendingProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1578,11 +1578,9 @@ Context fuzz tester error! Copy and paste the following line into the test suite
expect(() => {
ReactNoop.render(<Component />);
ReactNoop.flush();
}).toLowPriorityWarnDev(
'You are using the Context from React.createContext() as a consumer.' +
'The correct way is to use Context.Consumer as the consumer instead. ' +
'This usage is deprecated and will be removed in a future major release.',
{withoutStack: true},
}).toWarnDev(
'Rendering <Context> directly is not supported and will be removed in ' +
'a future major release. Did you mean to render <Context.Consumer> instead?',
);
});
});