dillon1000/react

Commit

Throw a better error when Lazy/Promise is used in React.Children (#28280)

We could in theory actually support this case by throwing a Promise when
it's used inside a render. Allowing it to be synchronously unwrapped.
However, it's a bit sketchy because we officially only support this in
the render's child position or in `use()`.

Another alternative could be to actually pass the Promise/Lazy to the
callback so that you can reason about it and just return it again or
even unwrapping with `use()` - at least for the forEach case maybe.
Browse files
Changed paths3 files
First-parent comparison
M packages/react/src/ReactChildren.js ModifiedM packages/react/src/__tests__/ReactChildren-test.js ModifiedM scripts/error-codes/codes.json Modified
Patch

Files changed

Rendering syntax-highlighted changes…