Refactor React.Children to reduce indirection (#18332)
Refactor React.Children to reduce indirection (#18332)

* Don't pool traversal context

* Remove traverseAllChildrenImpl indirection

All usages are internal so we can simply use the inner function directly.

* Implement forEach through map

* Remove second usage of traverseAllChildren

This isn't useful by itself but makes the layering easier to follow. traverseAllChildren is only used at the lowest layer now.

* Reimplement count() and toArray() in terms of map()

* Inline the only use of mapSingleChildIntoContext

* Move forEach down in the file

* Use the language

Get rid of the traversal context. Use closures.

* Make mapIntoArray take an already escaped prefix

* Move count state out of mapIntoArray

* Inline traverseAllChildren into mapIntoArray

* Inline handleChild into mapIntoArray
facebook/react,ericyang321/react,facebook/react,acdlite/react,ericyang321/react,chicoxyzzy/react,terminatorheart/react,billfeller/react,acdlite/react,cpojer/react,glenjamin/react,billfeller/react,billfeller/react,tomocchino/react,facebook/react,billfeller/react,billfeller/react,acdlite/react,tomocchino/react,cpojer/react,tomocchino/react,mosoft521/react,trueadm/react,glenjamin/react,yungsters/react,acdlite/react,trueadm/react,glenjamin/react,facebook/react,tomocchino/react,glenjamin/react,mosoft521/react,yungsters/react,ericyang321/react,tomocchino/react,chicoxyzzy/react,terminatorheart/react,glenjamin/react,ericyang321/react,mosoft521/react,trueadm/react,terminatorheart/react,chicoxyzzy/react,ericyang321/react,ericyang321/react,camsong/react,camsong/react,camsong/react,mosoft521/react,ericyang321/react,yungsters/react,mosoft521/react,yungsters/react,glenjamin/react,chicoxyzzy/react,billfeller/react,mosoft521/react,tomocchino/react,ArunTesco/react,acdlite/react,camsong/react,billfeller/react,glenjamin/react,cpojer/react,cpojer/react,acdlite/react,acdlite/react,chicoxyzzy/react,cpojer/react,yungsters/react,facebook/react,trueadm/react,chicoxyzzy/react,ArunTesco/react,trueadm/react,cpojer/react,camsong/react,terminatorheart/react,camsong/react,terminatorheart/react,mosoft521/react,trueadm/react,chicoxyzzy/react,terminatorheart/react,trueadm/react,yungsters/react,tomocchino/react,cpojer/react,facebook/react,facebook/react,camsong/react,yungsters/react,ArunTesco/react