dillon1000/react

Commit

Revert Flattening of Children

I still think the semantics of flattening children is valid but we'll
want to revert the flattening implementation while we solidify the
semantics and try another approach.

This reverts flattening so that this.props.children can once again be
either a single child, flat array or nested array.

mapChildren calls flattenChildren before doing anything else. This is
not the most efficient approach but I wanted to keep this inital diff
simple. It also ignores empty values for backwards compatibility.

We may want to try another approach where empty values are included
in the map.

Validation of keys is still done inside ReactComponent. Ideally I'd
like to extract that into a separate module but to avoid cyclic
dependencies, I'm keeping it in ReactComponent for now.
Browse files
Changed paths10 files
First-parent comparison
M src/core/ReactComponent.js ModifiedM src/core/ReactCompositeComponent.js ModifiedM src/core/ReactCurrentOwner.js ModifiedD src/core/__tests__/ReactComponentFlattenChildren-test.js DeletedM src/core/__tests__/ReactIdentity-test.js ModifiedM src/core/__tests__/ReactMultiChildReconcile-test.js ModifiedM src/utils/__tests__/mapChildren-test.js ModifiedM src/utils/flattenChildren.js ModifiedM src/utils/mapChildren.js ModifiedM src/utils/onlyChild.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…