TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Is Svelte lean and pragmatic or missing something?

15 点作者 StefanWestfal超过 3 年前
Context: I am a full stack developer that uses React to build simple UIs for technical simulations.<p>When working with React I spent a lot of time, also out of curiousity, on different solutions for certain problems (Think of Redux, MobX, and Recoil or React wrappers like React-Konva). With Svelte I don&#x27;t do that. It seems most basic functionality is included in a thin layer of abstract above HTML, CSS, and JS (ref. The truth about Svelte by Rich Harris) and the Svelte standard library. From state management, reactivity, and with SvelteKit, to SSR and code splitting. For problems not covered is was, until now, always easy to use TS&#x2F;JS.<p>Question: is Svelte lean and pragmatic or is it missing something?<p>Note: I know React, use it, and like it (especially with hooks &amp; Redux-Toolkit). As I am far from senior, maybe there are some complexities I am not seeing yet.

5 条评论

bionhoward超过 3 年前
My main concern which made me switch back to NextJS was debugging with useful error messages, given the Svelte system does different things; when I played with it for a graph visualization thing, it hadn’t had all the edge cases found so I felt like getting into bigger project I had trouble finding where my bugs were when I was using Svelte;<p>that was at least a year ago so if those issues are resolved then it’s a compelling framework to play with for sure, I like how Svelte feels just like HTML&#x2F;CSS&#x2F;JS and Svelte performance could be superior to React if certain claims are true about disappearing framework vs virtual dom. Not sure how SSR impacts those performance pros and cons between Next and Svelte so it’d be interesting to find published and updated latency benchmark numbers for both.<p>React hooks can be different to reason about though because of immutable state patterns vs two-way data binding; I actually really like the hooks and immutability ideas, but two way binding is much more elegant and simple sometimes. Edit: also those don’t have to be exclusive
评论 #29969553 未加载
aristofun超过 3 年前
Not familiar with Svelte, but definitely see how React ecosystem favored overengineered solitions like redux etc. for a while.<p>Last versions of react seems to have overcame most of that burden though.
heasketh超过 3 年前
That&#x27;s why People, Svelte is revolutionary framework. Svelte Stores(state management) is such a joy to use.<p>It has good developer experience, but not much usage as say React.
Glench超过 3 年前
I don&#x27;t think you&#x27;re missing anything — part of Svelte&#x27;s value is in the name :)<p>Some other benefits that I like:<p><pre><code> — Styles are included so you don&#x27;t need a whole other library for doing styling. Automatic component-scoped CSS is great. You can also include whatever your favorite compile-to-css language is. - It&#x27;s faster than React because there&#x27;s no virtual dom. I&#x27;ve run into performance issues a lot with React and not much with Svelte. - Less boilerplate. According to this talk, React components translated into Svelte components have around 40% fewer characters: https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=BzX4aTRPzno - Less JS bloat!* The actual Svelte library gets compiled away so you don&#x27;t need to include e.g. the entire React runtime. *(There _is_ a crossover point when you have many many Svelte components where the bundle size will be more because each components has self-contained duplicated code, but my understanding is that it&#x27;s pretty high). - Use the HTML&#x2F;CSS&#x2F;JS&#x2F;TS I already know. There&#x27;s a little &quot;magic&quot; in the compiled reactivity system, but I&#x27;ve found it to be very minimal and easily understandable. I don&#x27;t have to learn much to be very productive in Svelte. - The interactive documentation. It&#x27;s stellar. I can change all the examples they give and play around with things. The REPL is also super useful when asking questions to other devs about Svelte: https:&#x2F;&#x2F;svelte.dev&#x2F;repl&#x2F; - Batteries included — Styles, animations, transitions, stores... all of these work really well together and I rarely have to go outside of Svelte itself. </code></pre> And SvelteKit is taking all this to the next level with making Svelte available throughout the full stack. Heck, I&#x27;m making a SaaS boilerplate built on top of SvelteKit because I love it so much: <a href="https:&#x2F;&#x2F;sveltesaas.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;sveltesaas.com&#x2F;</a><p>Some drawbacks to Svelte:<p><pre><code> - It&#x27;s not as popular as React so you&#x27;re not as well supported when developing. - The reactivity system can be a little magic (for example you can&#x27;t do array.push() to trigger a reactive update). - You have to learn the templating system instead of just using the JS you already know. A little unfortunate, but I honestly kind of like using templates — I don&#x27;t enjoy JSX at all.</code></pre>
评论 #29971042 未加载
FractalHQ超过 3 年前
Svelte really is a game changer!