13 ms·
Author here. Thanks for the thoughtful reply! I did indeed mix up `useMemo` and `React.memo` – fixed it in the post. You're right, I am skipping a lot of deta
by nolanl 3y ago
Author here. Thanks for the thoughtful reply!
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."
- n2d4 3y agoAppreciate the response! You're right on Svelte v5; I just confirmed that Svelte's new runes are indeed reactive: let count = $state(0); function increment() { count += 1; console.log(count + " + 1 = " + countPlusOne); // prints "1 + 1 = 2" } let countPlusOne = $derived(count + 1);
- lifeisstillgood 3y agocould you explain why this demonstrates svelte is reactive? 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
- anonzzzies 3y agoI never used svelte, so it’s probably a weird question, but how is increment() called?
- 698969 3y agoThe calling location has been omitted from the snippet. You don't need to do anything special to call it, just `increment()` wherever it's in scope. `<button on:click={() => increment()}>+</button>`
- ketzo 3y agoHard to ride the line between clear, concise explanation and perfect technical correctness; I thought you picked good tradeoffs in your article.
- culi 3y ago> I know that React doesn't invalidate the whole tree, but it does in the worst case You mean *invalidate the whole subtree, right?