You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/documentation/docs/01-introduction/04-svelte-js-files.md

592 B

title use_cases
.svelte.js and .svelte.ts files reusable reactive logic, shared state modules, composable reactive utilities, reactive helper functions

Besides .svelte files, Svelte also operates on .svelte.js and .svelte.ts files.

These behave like any other .js or .ts module, except that you can use runes. This is useful for creating reusable reactive logic, or sharing reactive state across your app (though note that you cannot export reassigned state).

[!LEGACY] This is a concept that didn't exist prior to Svelte 5