Svelte
A compiler-based framework with runes for reactivity and very little boilerplate; small bundles and a joyful developer experience.
Intermediate · about 10 hours · difficulty 3/5
Learn first: Declarative UI and Component Thinking
Svelte moves most framework work to compile time. Instead of shipping a runtime that diffs a virtual DOM, the compiler turns your components into small JavaScript that updates the DOM directly. Components read almost like plain HTML, CSS and JavaScript.
Core concepts (Svelte 5)
- Components live in
.sveltefiles with a<script>, markup and a scoped<style>block. - Runes make reactivity explicit:
$state()for reactive values,$derived()for computed values,$effect()for side effects and$props()for inputs. - Template blocks:
{#if},{#each items as item (item.id)},{#await}for promises. - Event handling with attributes like
onclick={handler}, andbind:valuefor two-way form binding. - Snippets (
{#snippet}and{@render}) for passing reusable markup. - Built-in transitions and animations such as
transition:fade.
Ecosystem
SvelteKit is the official app framework for routing, data loading and SSR. The ecosystem and job market are smaller than React's but growing, and the ideas transfer well.
Pitfalls
Many tutorials show Svelte 4 syntax (let reactivity and $: labels); learn runes. Deeply nested state and effects that write to state they read can still cause loops.
Good enough to move on
You can build a small app (a habit tracker or quiz) with runes, component props, each-blocks and a transition, and explain what the Svelte compiler does differently from React.
Key concepts
- Svelte components and scoped styles
- Runes: $state, $derived, $effect
- $props and component communication
- Template blocks: if, each, await
- Bindings
- Snippets
- Transitions and animations
Other options for this step
- React: The most widely used UI library: JSX, components, props, state and events. Our recommended framework for your first job.
- Vue: A progressive framework with single-file components and fine-grained reactivity; approachable and popular in Asia and Europe.
- Angular: A batteries-included framework from Google with TypeScript, dependency injection and signals; common in enterprises.
Mini project
Build a quiz app in Svelte with a timer ($effect), a score ($derived), animated transitions between questions and questions loaded with an await block.
Check yourself
Why can Svelte ship less JavaScript than a virtual DOM library for the same component?
Free resources
- Svelte Interactive Tutorial (Svelte)
- Svelte Documentation (Svelte)