svelte
2 Followers 4 Questions Created 8 months ago

Svelte is a frontend component-based web framework that offers a development experience very reminiscent of vanilla JS.

let or const for $derived runes in Svelte?

Variables in JavaScript can be defined using either let or const (ignoring the antiquated [var](...

0 votes 7 views 1 Answer Asked 28 days ago
How to type props in Svelte 5?

I understand that in Svelte 4 and previous versions props are individually declared using export let name: type = defaultValue;. For example in Svelte 4: I'm also aware of the new $props rune in Svelte 5, however I don't understand how I can type the props using th...

0 votes 7 views 1 Answer Asked about 1 month ago
s
69
How can I deal with localStorage in SvelteKit SSR?

I'm building a Notice component that users can dismiss, and I'm storing the displayed state of the notice, however, I would like to preserve it across sessions. localStorage seems like a good way to accomplish this, however, when trying to use localStorage I get s...

0 votes 11 views 1 Answer Asked about 2 months ago
How to loop an each block a specific x number of times in Svelte?

I know of Svelte's {#each} block which allows you to iterate over arrays or array-likes. However, there are some cases where I'm not interested in the data of an array, but rather in repeating a block a specific x number of time...

0 votes 22 views 1 Answer Asked about 2 months ago