logoalt Hacker News

h4ch1last Sunday at 9:37 PM1 replyview on HN

Using Svelte and building global state classes with $state(), $effect() has really helped with managing side-effects and surgical updates without building a custom event system which has historically added unnecessary boilerplate to many of my projects with a frontend.

Having components bound to or using any of the $states or $derived update automatically without having to manually register event listeners, firing events, etc.

Used to dislike runes so much initially, but working a bit more deeply with them has really made me appreciate the API changes.


Replies

CharlieDigitallast Monday at 12:37 PM

One of my favorite quotes coming out of the Svelte team with respect to runes[0]:

    > Like every other framework, we’ve come to the realisation that Knockout was right all along.
    >
    > Svelte 5’s reactivity is powered by signals, which are essentially what Knockout was doing in 2010. 
(Knockout was fantastic and easy to adopt because it felt like it "closed the loop" with events and simply made them more ergonomic to use)

The problem is actually React hooks which has created a paradigm that inverts this and is now the most dominant model. This inversion of the model of how reactivity works is the root cause of most of the pain and complexity with React.

[0] https://svelte.dev/blog/runes#Signal-boost