0Pricing
Sveltejs Academy · Lesson

The script template style Structure

Understand the three-part structure of a Svelte component file.

Three Sections

A Svelte component file has three optional top-level blocks: <script>, the markup, and <style>.

The script Block

The script block holds component logic in regular JavaScript or TypeScript.

<script>
  let name = "Ada";
</script>

All lessons in this course

  1. The script template style Structure
  2. Reactive Variables with let
  3. Interpolation: {expression}
  4. Computed Values: $: reactive declarations
← Back to Sveltejs Academy