# Svelte

> A compiler-based framework with runes for reactivity and very little boilerplate; small bundles and a joyful developer experience. Free notes, key concepts,...

Canonical: https://www.internhack.in/roadmaps/tracks/frontend/svelte
Last updated: 2026-11-28

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](https://www.internhack.in/roadmaps/tracks/frontend/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 `.svelte` files 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}`, and `bind:value` for 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](https://www.internhack.in/roadmaps/tracks/frontend/react): The most widely used UI library: JSX, components, props, state and events. Our recommended framework for your first job.
- [Vue](https://www.internhack.in/roadmaps/tracks/frontend/vue): A progressive framework with single-file components and fine-grained reactivity; approachable and popular in Asia and Europe.
- [Angular](https://www.internhack.in/roadmaps/tracks/frontend/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](https://svelte.dev/tutorial) (Svelte)
- [Svelte Documentation](https://svelte.dev/docs) (Svelte)

Previous: [Angular](https://www.internhack.in/roadmaps/tracks/frontend/angular) · Next: [Hooks, Refs and State Patterns](https://www.internhack.in/roadmaps/tracks/frontend/react-hooks)

## More in Components and Choosing a UI Framework

- [Declarative UI and Component Thinking](https://www.internhack.in/roadmaps/tracks/frontend/component-thinking)
- [React](https://www.internhack.in/roadmaps/tracks/frontend/react)
- [Vue](https://www.internhack.in/roadmaps/tracks/frontend/vue)
- [Angular](https://www.internhack.in/roadmaps/tracks/frontend/angular)
- [Svelte](https://www.internhack.in/roadmaps/tracks/frontend/svelte)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Frontend Developer Roadmap](https://www.internhack.in/roadmaps/tracks/frontend)
