-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
Description
Describe the problem
People tend to overuse $effect
. We should make it clear in the documentation when to actually use it, and when to use other things instead.
This doesn't need to be on the preview docs but should certainly be part of the final docs.
Describe the proposed solution
If we have a more general guide for runes, describe how to ensure reactivity in various ways and try to avoid mentioning $effect
as much as possible.
In the API section, within $effect
, start by saying that you likely don't need $effect
:
- If you want something to update in reaction to something else, use
$derived
- If you want to have something update from above but also modify it from below (i.e. you want some kind of "writable
$derived
"), use an object with getters and setters instead (no glitches/dangers of infinite loops, works in SSR) - other use cases I can't think of right now that are common
Importance
would make my life easier
brunnerh, rmunn, AdrianGonz97, Jerboas86, MentalGear and 7 more