diff --git a/packages/react-reconciler/src/ReactFiberNewContext.js b/packages/react-reconciler/src/ReactFiberNewContext.js index cbba426499d0a..ac09ea2703f33 100644 --- a/packages/react-reconciler/src/ReactFiberNewContext.js +++ b/packages/react-reconciler/src/ReactFiberNewContext.js @@ -330,8 +330,10 @@ export function readContext( if (lastContextDependency === null) { invariant( currentlyRenderingFiber !== null, - 'Context can only be read while React is ' + - 'rendering, e.g. inside the render method or getDerivedStateFromProps.', + 'Context can only be read while React is rendering. ' + + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + + 'In function components, you can read it directly in the function body, but not ' + + 'inside Hooks like useReducer() or useMemo().', ); // This is the first dependency for this component. Create a new list.