by nolanl · 2y ago · 0 comments
I did indeed mix up `useMemo` and `React.memo` – fixed it in the post.
You're right, I am skipping a lot of details (hence "to grossly oversimplify"). I know that React doesn't invalidate the whole tree, but it does in the worst case. Maybe I should add a note about that.
Svelte not being truly reactive makes perfect sense, but in Svelte v5 my understanding is that "runes mode" does exactly that. This is what I mean by "moving in that direction."
let count = $state(0);
function increment() {
count += 1;
console.log(count + " + 1 = " + countPlusOne); // prints "1 + 1 = 2"
}
let countPlusOne = $derived(count + 1);What's the definition of reactive is I think my question and having a clear demo is useful - if I understood it it looks a useful piece code
`<button on:click={() => increment()}>+</button>`
You mean *invalidate the whole subtree, right?