@ -138,13 +138,13 @@ To run code whenever specific values change, or when a component is mounted to t
### What this replaces
The `$effect` rune is roughly equivalent to `$:` when it's being used for side-effects (as opposed to declarations). There are some important differences:
The portions of `$: {}` that are triggering side-effects can be replaced with `$effect` while being careful to migrate value computations to `$derived`. There are some important differences:
- Effects only run in the browser, not during server-side rendering
- They run after the DOM has been updated, whereas `$:` statements run immediately _before_
- You can return a cleanup function that will be called whenever the effect refires
Additionally, you will most likely find you can use effects in all the places where you previously used `onMount` and `afterUpdate` (the latter of which will be deprecated in Svelte 5).
Additionally, you may prefer to use effects in some places where you previously used `onMount` and `afterUpdate` (the latter of which will be deprecated in Svelte 5). There are some differences between these APIs as `$effect` should not be used to compute reactive values and will be triggered each time a reactive variable changes referenced changes (unless using `$untrack`).