dillon1000/react

Commit

Fix `key` Warning for Flattened Positional Children (#29662)

## Summary

https://github.com/facebook/react/pull/29088 introduced a regression
triggering this warning when rendering flattened positional children:

> Each child in a list should have a unique "key" prop.

The specific scenario that triggers this is when rendering multiple
positional children (which do not require unique `key` props) after
flattening them with one of the `React.Children` utilities (e.g.
`React.Children.toArray`).

The refactored logic in `React.Children` incorrectly drops the
`element._store.validated` property in `__DEV__`. This diff fixes the
bug and introduces a unit test to prevent future regressions.

## How did you test this change?

```
$ yarn test ReactChildren-test.js
```
Browse files
Changed paths2 files
First-parent comparison
M packages/react/src/__tests__/ReactChildren-test.js ModifiedM packages/react/src/jsx/ReactJSXElement.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…