S
SolidJS3mo ago
abe

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.
No description
5 Replies
Eve
Eve3mo ago
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 index
weeBlord
weeBlord3mo ago
What if both need to be reactive? :solid:
Đăng Tú
Đăng Tú3mo ago
Maybe nesting those components?
bigmistqke
bigmistqke2mo ago
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
bigmistqke
bigmistqke2mo ago
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.
Want results from more Discord servers?
Add your server