-
|
In react we can set key in list to optimize dom rendering. In solid I didn't found the same pattern to decare which component should be kept and which should be new. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
Solid's
Generally I point people to |
Beta Was this translation helpful? Give feedback.
Solid's
Foris keyed by default by reference to the data. The reason is reactivity is based on mutation so very little reason to key by value as if you were to persist the value while changing the data you'd need to re-recreate all the reactive bindings anyway. So immutable structural cloning doesn't work well here. Now not to say that isn't an option and I've thrown a demo together making this: https://codesandbox.io/s/explicit-keys-4iyen but it is unoptimal by definition for anything with depth.Indexis an alternative to key by index which makes sense for simple primitive values where a key isn't an option. Primitives don't really have any depth in their data so it isn't problematic.G…