Questions tagged [svelte]

Svelte is a component framework — like React or Vue. On-topic questions include code using Svelte and how to configure it and use it in your javascript pipelines.

Svelte is a frontend framework but can be augmented with SvelteKit to provide a fullstack experience. It is a component-based framework, similar to React or Vue, but it does not use a virtual DOM and compiles to vanilla JavaScript.

Learn Svelte

Links

5308 questions
109
votes
9 answers

How to pass parameters to on:click in Svelte?

Binding a function to a button is easy and straightforward: But I don't see a way to pass parameters (arguments) to the function, when I do this:
Félix Paradis
  • 5,165
  • 6
  • 40
  • 49
64
votes
4 answers

Svelte 3 - How to loop each block X amount of times

I'm hoping to find a way to iterate over an #each block a set amount of times in Svelte 3. In Vue I would do something like this:
  • But as I understand Svelte handles loops much differently using the…
    JHeth
    • 7,067
    • 2
    • 23
    • 34
    63
    votes
    13 answers

    How to persist svelte store

    Is there any direct option to persist svelte store data so that even when the page is refreshed, data will be available. I am not using local storage since I want the values to be reactive.
    Anil Sivadas
    • 1,658
    • 3
    • 16
    • 26
    48
    votes
    1 answer

    Cannot access 'variable_name' before initialization

    When using reactive variables by declaring them using the $: syntax, you get the following error. Cannot access 'variable_name' before initialization Here is the code: App.svelte