Svelte for Beginners
Build fast, interactive web pages with Svelte 5: components, runes, events, forms, props, transitions and data loading, then set up SvelteKit.
- 0 students
- 89 lessons
- 6 h 50 min
Created by Ayim Nelson
What you will learn
- Explain what Svelte is and how its compiler turns components into JavaScript
- Write components with markup, {expressions}, scoped styles and class and style directives
- Make pages interactive with $state, $derived, $effect and event handlers
- Show lists and conditions with {#if}, {#each} and {#await}
- Build forms with bind:value, bind:checked, bind:group and validation
- Compose components with $props, callback props, $bindable, children and snippets
- Share state with .svelte.js files, context and stores, and animate with transitions
- Set up a SvelteKit project with Vite and read older Svelte 4 syntax
About this course
Svelte is a compiler for building interactive websites: you write small, readable components and Svelte turns them into fast, plain JavaScript. In this course you learn Svelte 5 and its runes by building a Trotro Fare Planner for Accra, one short lesson at a time: markup and expressions, $state, $derived and $effect, events, logic blocks, forms and bindings, components, props and snippets, shared state, transitions and loading data. Every lesson's code compiles and runs right here in your browser, with nothing to install.
For: anyone who has finished the JavaScript Crash Course or already knows the basics of JavaScript: variables, functions, arrays, objects, arrow functions, array methods like map() and filter(), and Promises. A little HTML and CSS helps too.
By the end: you'll have built a fare planner where riders pick routes, work out fares for a group, save trips, see service alerts and load the timetable from a (fake) server, and you'll know how to start a real SvelteKit project with Vite and read older Svelte 4 code.
Course content
11 sections · 89 lessons
Meet Svelte8 lessons
- What Svelte isPreviewReading · 3 min
- A Svelte componentPreviewReading · 3 min
- Your first Svelte pagePreviewReading · 4 min
- The runner linesReading · 4 min
- What the compiler makesReading · 4 min
- Errors in the previewReading · 3 min
- Svelte 5 and runesReading · 3 min
- Akwaaba fare boardExercise · 8 min
Markup and expressions9 lessons
- Markup is HTMLReading · 3 min
- Expressions in bracesReading · 3 min
- Formatting numbersReading · 3 min
- Attributes with expressionsReading · 3 min
- Shorthand attributesReading · 3 min
- Scoped stylesReading · 3 min
- Classes from dataReading · 3 min
- The style: directiveReading · 3 min
- Route cardExercise · 10 min
State and events8 lessons
- Reactive state with $stateReading · 4 min
- Handling eventsReading · 3 min
- Event handler functionsReading · 3 min
- State arrays and objectsReading · 4 min
- Derived values with $derivedReading · 4 min
- Longer calculations with $derived.byReading · 3 min
- Replacing state with $state.rawReading · 3 min
- Passenger counterExercise · 12 min
Effects and lifecycle7 lessons
- Side effects with $effectReading · 4 min
- What an effect tracksReading · 3 min
- Cleaning up an effectReading · 4 min
- Effects are not for derived valuesReading · 3 min
- Running code with onMountReading · 3 min
- Cleaning up with onDestroyReading · 3 min
- Departure countdownExercise · 12 min
Logic blocks8 lessons
- Showing things with {#if}Reading · 3 min
- {:else if} and {:else}Reading · 3 min
- Lists with {#each}Reading · 3 min
- Index and destructuring in {#each}Reading · 3 min
- Keyed {#each} blocksReading · 4 min
- Empty lists with {:else}Reading · 3 min
- Local values with {@const}Reading · 3 min
- Route finderExercise · 12 min
Forms and bindings8 lessons
- Two-way binding with bind:valueReading · 4 min
- Number inputsReading · 3 min
- Checkboxes with bind:checkedReading · 3 min
- Select menusReading · 3 min
- Radio buttons with bind:groupReading · 3 min
- Submitting a formReading · 4 min
- Checking input before savingReading · 3 min
- Fare calculatorExercise · 15 min
Components and props10 lessons
- Using one component in anotherReading · 4 min
- Props with $propsReading · 4 min
- Default prop valuesReading · 3 min
- Passing many props at onceReading · 3 min
- Callback props for eventsReading · 4 min
- Two-way props with $bindableReading · 4 min
- Children contentReading · 4 min
- Snippets with {#snippet}Reading · 4 min
- Passing snippets to componentsReading · 4 min
- Planner from componentsExercise · 15 min
Sharing state7 lessons
- Prop drillingReading · 3 min
- Shared state in a .svelte.js fileReading · 4 min
- Context with setContext and getContextReading · 4 min
- Stores with writableReading · 4 min
- The $store shorthandReading · 3 min
- Runes, context or stores?Reading · 3 min
- Shared trip basketExercise · 15 min
Transitions and motion6 lessons
- Fading in and outReading · 3 min
- Transition optionsReading · 3 min
- Separate in and outReading · 4 min
- Moving list items with animate:flipReading · 4 min
- Smooth numbers with TweenReading · 3 min
- Service alertsExercise · 12 min
Loading data7 lessons
- Why the lessons fake their dataReading · 3 min
- A fake fetch functionReading · 3 min
- Loading in onMountReading · 4 min
- Waiting with {#await}Reading · 4 min
- Handling errors with {:catch}Reading · 4 min
- Loading with a real fetchReading · 4 min
- Live timetableExercise · 15 min
SvelteKit and real projects11 lessons
- Svelte and SvelteKitReading · 3 min
- Creating a project with sv createReading · 4 min
- The project's filesReading · 3 min
- Pages are foldersReading · 4 min
- LayoutsReading · 3 min
- Loading data with +page.jsReading · 4 min
- Shared code with #libReading · 3 min
- Building for the webReading · 3 min
- Older Svelte syntaxReading · 4 min
- Upgrade to runesExercise · 12 min
- Final quizQuiz · 10 min
Reviews
No reviews yet.
Comments
Log in to join the conversation.
Loading comments...