S
SolidJS3w 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
Eve3w 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
weeBlord2w ago
What if both need to be reactive? :solid:
Đăng Tú
Đăng Tú2w ago
Maybe nesting those components?
bigmistqke
bigmistqke2w 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
bigmistqke2w 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