-
Notifications
You must be signed in to change notification settings - Fork 92
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
The child management in this guide is misleading #10
Comments
One interesting aspect here is that if your rendering target doesn't provide "mutative" methods like |
Thanks for letting me know about this. Just updated the tutorial and also the code. For reference, here is the link to a custom component in |
Do we need I’m worried it’s confusing people by association with the component render function. Another thing that’ll need updating is that the host config format changed a bit. Instead of the separate mutation object we now put all methods at the top, and have a property called supportsMutation that needs to be true in mutating renderers. |
Oh! I think we can drop Since now we are appending the child nodes using the platform specific mutative APIs, Anyway, I'll update the code and guide accordingly. Thanks for clarification! |
Updated the guide with best practices 😄 |
Please see this issue: facebook/react#13006.
Children aren't meant to be manually managed in an array. Instead, the idea is that you should call underlying library's
appendChild
and similar methods in yourappendChild
.Declaring classes and keeping track of children in arrays and then calling
render
kind of goes against that because you're ignoring the valuable information React gives you (which child was added/removed) and then somehow try to reconstruct it later.I temporarily removed the link to this tutorial from the README of the reconciler package but happy to re-add it if these issues are addressed. Also happy to answer more questions.
The text was updated successfully, but these errors were encountered: