Confused between For and index
Could someone please explain this a little more in depth, I am not able to follow the explanation on the tutorial.
5 Replies
In simplest terms, with
For
the value is reactive. With Index
the index is reactive.
So if you want to redraw when a value changes, use for. If you want to redraw when an item in the array is added/removed, use indexWhat if both need to be reactive? :solid:
Maybe nesting those components?
There is https://primitives.solidjs.community/package/list where both index and the element are a signal
Solid Primitives
A library of high-quality primitives that extend SolidJS reactivity
But there are little use cases for it. It came in handy one time where I received immutable data from another library and I didn't know about reconciled
merge
option.