-
-
Notifications
You must be signed in to change notification settings - Fork 634
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
Question about the key
prop
#406
Comments
@buzinas Unlike React, Inferno promotes correct usage of instances where you might want, and not want, keys. Using either in different situations can have different performance characteristics depending on what is being "patched". Inferno could warn for not using keys on lists that contain stateful DOM elements that can have big issues if not keyed (e.g. inputs, selects, iframes, video, audio etc) – but that's not in scope for now. It might be a good task to add to the issue backlog though. What do you and @Havunen think? |
I'm not using |
Performance wise it depends on situation, if you have fe. deep component hierarchy you definitely want to use keys to avoid horrible large changes in DOM tree. Also keyed works very nicely with shouldComponentUpdate while nonKeyed doesn't make much sense. in other hand if you compare it in simple UL LI I think non keyed wins. But like @trueadm mentioned already the main point is to keep the state. for example inputs. |
Closing as this topic seems finished :) |
React recommends the use of
key
for tracking dynamic children by its "primary key". When we don't use it, it also displays a warning.Inferno doesn't warn when we don't use, and I also saw somewhere (unfortunately, I was not able to find it again) that there is a huge performance improvement when we don't use the
key
prop. So, I would like to ask: what are the recommendations? What exactly are the benefits of using thekey
prop, and what are the drawbacks? What about not using it?The text was updated successfully, but these errors were encountered: