dillon1000/react

Commit

Allow returning null as host context (#9278)

If your renderer doesn't use host context, you might prefer to return null. This used to give an error:

> Invariant Violation: Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.

I use a sentinel value instead now.

The code in ReactFiberHostContext is a little complicated now. We could probably also just remove the invariants.
Browse files
Changed paths3 files
First-parent comparison
M scripts/fiber/tests-passing.txt ModifiedM src/renderers/shared/fiber/ReactFiberHostContext.js ModifiedA src/renderers/shared/fiber/__tests__/ReactFiberHostContext-test.js Added
Patch

Files changed

Rendering syntax-highlighted changes…