Hacker News new | past | comments | ask | show | jobs | submit login

What about scoped reactivity? Sometimes you need to react on some of the states not all of them. Right now we are achieving this by passing function with arguments to react on to $: but with $derived and $effect it seems to be not possible because it takes variables from every function passed. Are there any plans how to resolve this? Also nested $effect instead of onMount looks awfull and to be honest is less readable.



You can use `untrack` [1] when you don't want to react to some state inside an effect.

You can still use `onMount`. It's not deprecated [2], although `$effect` could be used similarly going forward.

[1] https://svelte-5-preview.vercel.app/docs/functions#untrack

[2] https://svelte-5-preview.vercel.app/docs/runes#$effect-what-...




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: