Skip to content

Commit

Permalink
updated message and pass undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Shailendra Gupta committed Jun 30, 2020
1 parent 8c85dc0 commit 1603910
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberBeginWork.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -2815,7 +2815,7 @@ function updateContextProvider(
if (!hasWarnedAboutUsingNoValuePropOnContextProvider) {
hasWarnedAboutUsingNoValuePropOnContextProvider = true;
console.error(
'The prop `value` is required in `Context.Provider`, have you misspelled it',
'The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?',
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberBeginWork.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -2812,7 +2812,7 @@ function updateContextProvider(
if (!hasWarnedAboutUsingNoValuePropOnContextProvider) {
hasWarnedAboutUsingNoValuePropOnContextProvider = true;
console.error(
'The prop `value` is required in `Context.Provider`, have you misspelled it',
'The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?',
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ describe('ReactNewContext', () => {
);

expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
'The prop `value` is required in `Context.Provider`, have you misspelled it',
'The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?',
{
withoutStack: true,
},
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/__tests__/ReactContextValidator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,13 @@ describe('ReactContextValidator', () => {

class Component extends React.Component {
render() {
return <TestContext.Provider value={null} />;
return <TestContext.Provider value={undefined} />;
}
}

expect(() => ReactTestUtils.renderIntoDocument(<Component />)).toErrorDev(
'Warning: Failed prop type: The prop `value` is marked as required in ' +
'`Context.Provider`, but its value is `null`.\n' +
'`Context.Provider`, but its value is `undefined`.\n' +
' in Component (at **)',
);
});
Expand Down

0 comments on commit 1603910

Please sign in to comment.