-
Notifications
You must be signed in to change notification settings - Fork 47.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove sliceChildren #9109
Remove sliceChildren #9109
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
Well this is used by code internally at FB so maybe we should expose it publicly rather than just keeping it as an internal helper? |
It predated |
Currently the helper is simple but we could optimize it more on our end since we don't have to first create a large array with adjusted/concatenated keys and new elements and then take a small subset of those. |
Like one of our use cases is: <div>
{sliceChildren(this.props.children, 0, 1)}
</div>
<div>
{sliceChildren(this.props.children, 1)}
</div> This is really inefficient for any significant number of children. Especially if they're nested. The EDIT: I suppose in this case, this you would reuse the array which isn't not as bad but also not as good as we could make it with a custom data structure. |
Ah okay. My concern was the opposite: the method |
Maybe we should just unify on lodash's lazy evaluation chained "Seq Methods". |
Another file that looks unused. It's not exposed via any public API like
React.Children
and is not required anywhere internally in react, react-native, or react-art.Similar situation as #9107. Looks unused, but maybe not 😄