dillon1000/react
Commit
Browse files Disallow reading context during useMemo etc (#14648)
* Disallow reading context during useMemo etc * Continue allowing readContext() in classes and context consumers The previous commit check was too broad and incorrectly restricted classes from calling readContext(). This check is more precise and only targets components that are Hook-capable. It exploits the fact that `renderExpirationTime` is never `NoWork` after `renderWithHooks` -- something we already rely on.
Changed paths4 files
First-parent comparisonpackages/react-reconciler/src/ReactFiberClassComponent.js ModifiedM packages/react-reconciler/src/ReactFiberDispatcher.js ModifiedM packages/react-reconciler/src/ReactFiberHooks.js ModifiedM packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…