Replies: 2 comments
-
It's because in your first case For is being subscribed to alone, Where you call the cats function matters. Calling it in the expression in the The main reason we |
Beta Was this translation helpful? Give feedback.
-
Ah gotcha, that makes sense. Thank you. |
Beta Was this translation helpful? Give feedback.
-
Please see this simple example which renders a list of items. A console.log inside the shows how many times each item was rendered.
https://playground.solidjs.com/anonymous/63e3a992-3a1c-4d9b-bd11-2e1c06811b16
When run, it logs just once when an item is added. I presume this is because memoizes each value, thus existing items do not get re-rendered.
If you replace, line 26 with line 27, this behaviour changes completely and it logs for each existing item as well i.e. as many times as the size of the list. Why is the memoization not effective in this case, despite there being no change in the memo function's dependencies?
And what difference does it make to
li
function whether you pass the signal from outside as in line 26? Shouldn't its dependencies be same in both cases?Beta Was this translation helpful? Give feedback.
All reactions