Ask HN: What are your experiences with Svelte (JS framework)
I&#x27;ve posted before about my experience with svelte (<a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20338175" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20338175</a>). Will try to reiterate a few of them here.<p>I&#x27;ve been using it internally at my current job to great effect since March, after I convinced my manager to let me try it on a one-off project. That small project has led to us using it for other bigger projects, again pretty successfully.<p>tl;dr – I probably wouldn&#x27;t choose to go back to other frameworks after my time in Svelte-land unless I&#x27;m in a situation where I have to use React. I don&#x27;t MIND React, but it&#x27;s clear that all things equal it simply takes longer to make things with it and the thing I make tends to be harder to work on over time. Svelte is just too good and has probably saved my company some money in dev time &amp; dev happiness. For reference, I work across the data stack – data engineering to stats &#x2F; ml modeling to frontends &#x2F; products that use data. It shines in all areas, but it REALLY shines in data viz.<p>pros:<p>- the time to first meaningful render in svelte is substantially, substantially lower than it is in React, and you face none of the drawbacks of using the React starter stuff (ie ejecting isn&#x27;t a thing). This may seem like a weird metric, but I think it&#x27;s pretty vital. I can easily start a side project w&#x2F; svelte and not have to think deeply about getting all the dependencies, all the webpack stuff fiddled with, all that. The ramp to productivity is pretty flat.<p>- you don&#x27;t need the Friends part of React &amp; Friends nearly as much, but you can definitely use the ones that are framework-agnostic (like immer, or redux, or whatever). W&#x2F; the bigger React projects I work on, I have really struggled with the development speed of 3rd party libraries forcing me to update my components and wasting time. Having fewer dependencies has made my life substantially better. Most projects I just use immer + d3 modules.<p>- I was pleased to discover that in practice, the boilerplate doesn&#x27;t ever sneak in, even in complex components. This means that I can either (1) deliver the thing faster, and &#x2F; or (2) in the same amount of time, make it that much better. It ends up being that both of those things happen.<p>- svelte stores are incredible. We tend to use them with immer to make redux-like app state work nicely, but we use stores for all sorts of things – contexts for complex components like data graphics (ie we need to share reactive changes arbitrarily to children), tweened and spring. One way that I enjoy using them – I take params from my app store (the one I make w&#x2F; immer) and create a derived store that encapsulates a cached dataset request. There are SO MANY cool patterns you can implement with stores that makes your app easy to reason about. Example of a svelte immer app here: <a href="https:&#x2F;&#x2F;github.com&#x2F;hamilton&#x2F;svelte-immer-example" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;hamilton&#x2F;svelte-immer-example</a><p>- having a great story for both style &amp; animation really makes you think that most other frameworks are feature-incomplete. The component authoring experience really makes html and css feel like first-class citizens again. I currently have a designer helping me tweak the css of a bunch of components I&#x27;ve written, and it&#x27;s wonderful – he doesn&#x27;t have to learn all the css-in-js stuff I&#x27;ve encountered in other frameworks.<p>- Svelte truly, truly shines with data visualization, where the reactivity has reduced the cost of authoring data graphics for me. I say this as someone who used to use Protovis and then spent a lot of time in D3-land. Hoping svelte gl lands publicly sometime soon so I can get off of the regl train.<p>- Svelte creates joy the way jQuery did in the past. I noticed a talk by Rich where he talks about jQuery. This has been how I&#x27;ve described svelte to folks @ my work, and they get it – it DID feel magical then.<p>cons:<p>- the testing story isn&#x27;t well-documented yet, and it probably just doesn&#x27;t exist yet. I tend to just move code that definitely needs to be tested into separate modules and test them there.<p>- typescript support would be really nice.<p>- the community is small, so you have to find answers yourself or make them. This may not appeal to a lot of corporate frontend devs, but it works @ Mozilla where I work, since most folks are pretty web-friendly. I personally prefer this since things that are hard in other frameworks are trivial in Svelte. That is, you just don&#x27;t need that big a community to be similarly productive.<p>- your dev culture has to be right for this, and the risk of moving has to be understood. It takes time to figure out how new frameworks pay off.