Skip to content
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

Pass generated key to Children.map/forEach #1982

Closed
wants to merge 1 commit into from

Conversation

chenglou
Copy link
Contributor

@chenglou chenglou commented Aug 3, 2014

No description provided.

@chenglou
Copy link
Contributor Author

chenglou commented Aug 3, 2014

@spicyj @sebmarkbage

TODO: docs.

@sophiebits
Copy link
Collaborator

I know @sebmarkbage was considering having a method that takes a children object/array and flattens it, returning a new list with properly-keyed descriptors…

@syranide
Copy link
Contributor

syranide commented Aug 4, 2014

One thing to note is that internally/externally flattened children are not compatible. Keys for externally flattened children will become data-reactid=".$=10=20" rather than data-reactid=".0:0", until we can get rid of DOM and concatenated IDs. If the source keys have non-safe characters they end up having to be double-escaped.

@sebmarkbage
Copy link
Collaborator

I think that we should return a new descriptor for every child that has the flattened key. This should be fairly cheap (but still expensive).

Otherwise it's still easy to make mistakes because you don't know which key to use. This would also avoid the need for map() to return an object. It could be an array.

@sophiebits
Copy link
Collaborator

It can at least share the props object, right?

@sebmarkbage
Copy link
Collaborator

Yes. Assuming nobody is mutating it after cloning but that should be a no-no.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants