Need advice about which tool to choose?Ask the StackShare community!
Preact vs Svelte: What are the differences?
Preact: A fast 3k React alternative. Preact is an attempt to recreate the core value proposition of React (or similar libraries like Mithril) using as little code as possible, with first-class support for ES2015. Currently the library is around 3kb (minified & gzipped); Svelte: A UI framework that compiles into tiny standalone JavaScript modules. If you've ever built a JavaScript application, the chances are you've encountered – or at least heard of – frameworks like React, Angular, Vue and Ractive. Like Svelte, these tools all share a goal of making it easy to build slick interactive user interfaces. Rather than interpreting your application code at run time, your app is converted into ideal JavaScript at build time. That means you don't pay the performance cost of the framework's abstractions, or incur a penalty when your app first loads.
Preact and Svelte can be categorized as "Javascript UI Libraries" tools.
"Lightweight" is the top reason why over 7 developers like Preact, while over 2 developers mention "Javascript compiler (do that browsers don't have to)" as the leading cause for choosing Svelte.
Preact and Svelte are both open source tools. It seems that Preact with 22.9K GitHub stars and 1.19K forks on GitHub has more adoption than Svelte with 19.2K GitHub stars and 715 GitHub forks.
Svelte is everything a developer could ever want for flexible, scalable frontend development. I feel like React has reached a maturity level where there needs to be new syntactic sugar added (I'm looking at you, hooks!). I love how Svelte sets out to rebuild a new language to write interfaces in from the ground up.
Svelte 3 is exacly what I'm looking for that Vue is not made for.
It has a iterable dom just like angular but very low overhead.
This is going to be used with the application.
for old/ lite devices . ie. * android tv, * micro linux, * possibly text based web browser for ascci and/or linux framebuffer * android go devices * android One devices
Preact offers an API which is extremely similar to React's for less than 10% of its size (and createElement
is renamed to h
, which makes the overall bundle a lot smaller). Although it is less compatible with other libraries than the latter (and its ecosystem is nowhere as developed), this is generally not a problem as Preact exposes the preact/compat
API, which can be used as an alias both for React and ReactDOM and allows for the use of libraries which would otherwise just be compatible with React.
Pros of Preact
- Lightweight14
- Drop-in replacement for React5
- Props/state passed to render3
- Performance3
- ES6 class components1
Pros of Svelte
- Performance53
- Reactivity38
- Components34
- Javascript compiler (do that browsers don't have to)34
- Simplicity33
- Lightweight30
- Near to no learning curve28
- Fast as vanilajs26
- Real Reactivity26
- All in one22
- Use existing js libraries18
- Compiler based18
- Very easy for beginners16
- SSR16
- Scalable16
- Composable13
- No runtime overhead12
- Ease of use12
- Built in store10
- Typescript9
- Best Developer Experience7
- Start with pure html + css7
- Templates6
- Speed4
Sign up to add or upvote prosMake informed product decisions
Cons of Preact
Cons of Svelte
- Event Listener Overload3
- Little to no libraries2
- Complex2
- Learning Curve2
- Hard to learn2