Replies: 1 comment 2 replies
-
|
If you know that the variable never changes (and you don't want to future-proof either), you can suppress the warning: // svelte-ignore state_referenced_locally
const t = getTranslator(locale);But, given that this is more verbose and not great if things do change later, just adding a |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using Svelte 5 within an Astro project.
I pass a
localeprop from Astro to a Svelte component, and thislocalenever changes during the component's lifecycle.Should I wrap these in
$derived()even though I know they will never re-calculate?Beta Was this translation helpful? Give feedback.
All reactions