Skip to content
Discussion options

You must be logged in to vote

Solid's For is 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.

Index is 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…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@zhaoyao91
Comment options

@ryansolid
Comment options

@ArthurClemens
Comment options

@ryansolid
Comment options

@dvdvdmt
Comment options

Answer selected by ryansolid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants