diff --git a/apps/svelte.dev/content/docs/svelte/02-runes/04-$effect.md b/apps/svelte.dev/content/docs/svelte/02-runes/04-$effect.md index 3e71a3ab4..9485d6038 100644 --- a/apps/svelte.dev/content/docs/svelte/02-runes/04-$effect.md +++ b/apps/svelte.dev/content/docs/svelte/02-runes/04-$effect.md @@ -256,6 +256,30 @@ const destroy = $effect.root(() => { destroy(); ``` +## `$effect.allowed` + +The `$effect.allowed` rune is an advanced feature that indicates whether or not an effect or [async `$derived`](await-expressions) can be created in the current context. To improve performance and memory efficiency, effects and async deriveds can only be created when a root effect is active. Root effects are created during component setup, but they can also be programmatically created via `$effect.root`. + +```svelte + + + +``` + ## When not to use `$effect` In general, `$effect` is best considered something of an escape hatch — useful for things like analytics and direct DOM manipulation — rather than a tool you should use frequently. In particular, avoid using it to synchronise state. Instead of this... pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy