News for hackers. Stuff that matters.
Re:The new wave of React state management by nine_k on Saturday July 02, 2022 @12:44PM (#31960504)
Svelte does wonders to code size, indeed.

But does it solve the problem of growing state which never gets GC'd when components which used to use it are gone? Does it solve the problem of only redrawing the required minimum (beside the normal VDOM approach)?

I'm asking as someone not knowledgeable enough about Svelte.

Re:The new wave of React state management by doodlesdev on Saturday July 02, 2022 @01:00PM (#31960638)
> Does it solve the problem of only redrawing the required minimum (beside the normal VDOM approach)?

Yes, in fact I think it's actually pretty hard _not_ to redraw the bare minimum LOL. If you want to know more about Svelte (even if you're not looking to develop with it) I HIGHLY recommend listening to this presentation called "Rethinking reactivity" by Rich Harris (the creator) https://youtu.be/AdNJ3fydeao

> But does it solve the problem of growing state which never gets GC'd when components which used to use it are gone?

I think the answer to the question is yes. Although the problem I'm speaking mostly about state management is the source of truth problem. Svelte provides a global store to store data, and data stored on local components are just _variables_ (no useState or hooks or anything complicated) where the Svelte compiler handles everything.

Something else I'm really eyeing right now is SolidJS which takes a very similar approach to Svelte (compiler instead of library) for frontend development but provides an API that's very familiar to React developers so there's not much of a learning curve (although Svelte has a very easy learning curve too).