I was complaining a few weeks ago how multiline derived runes in Svelte 5 are such a pain to write.

I used a suggestion from the internet to pass an arrow function and immediately call it as a workaround.

However, somehow I missed a glaringly obvious section in the documentation about Svelte's solution to this: a special rune function `$derived.by()`.

Much, much neater!

svelte.dev/docs/svelte/$derive

0

If you have a fediverse account, you can quote this note from your own instance. Search https://hachyderm.io/users/mahryekuh/statuses/115972476469320971 on your instance and quote it. (Note that quoting is not supported in Mastodon.)