Skip to content

Commit 1603910

Browse files
author
Shailendra Gupta
committed
updated message and pass undefined
1 parent 8c85dc0 commit 1603910

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

packages/react-reconciler/src/ReactFiberBeginWork.new.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2815,7 +2815,7 @@ function updateContextProvider(
28152815
if (!hasWarnedAboutUsingNoValuePropOnContextProvider) {
28162816
hasWarnedAboutUsingNoValuePropOnContextProvider = true;
28172817
console.error(
2818-
'The prop `value` is required in `Context.Provider`, have you misspelled it',
2818+
'The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?',
28192819
);
28202820
}
28212821
}

packages/react-reconciler/src/ReactFiberBeginWork.old.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2812,7 +2812,7 @@ function updateContextProvider(
28122812
if (!hasWarnedAboutUsingNoValuePropOnContextProvider) {
28132813
hasWarnedAboutUsingNoValuePropOnContextProvider = true;
28142814
console.error(
2815-
'The prop `value` is required in `Context.Provider`, have you misspelled it',
2815+
'The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?',
28162816
);
28172817
}
28182818
}

packages/react-reconciler/src/__tests__/ReactNewContext-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ describe('ReactNewContext', () => {
10971097
);
10981098

10991099
expect(() => expect(Scheduler).toFlushWithoutYielding()).toErrorDev(
1100-
'The prop `value` is required in `Context.Provider`, have you misspelled it',
1100+
'The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?',
11011101
{
11021102
withoutStack: true,
11031103
},

packages/react/src/__tests__/ReactContextValidator-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,13 @@ describe('ReactContextValidator', () => {
263263

264264
class Component extends React.Component {
265265
render() {
266-
return <TestContext.Provider value={null} />;
266+
return <TestContext.Provider value={undefined} />;
267267
}
268268
}
269269

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

0 commit comments

Comments
 (0)