diff --git a/documentation/docs/07-misc/01-best-practices.md b/documentation/docs/07-misc/01-best-practices.md index 625766a8a9..50cb0a8131 100644 --- a/documentation/docs/07-misc/01-best-practices.md +++ b/documentation/docs/07-misc/01-best-practices.md @@ -67,9 +67,26 @@ let color = type === 'danger' ? 'red' : 'green'; ## Events -Any element attribute starting with `on` is treated as an event listener (e.g. ` + + + + + + +``` + +If you need to attach listeners to `window` or `document` you can use `` and ``: + +```svelte + + +``` + +Avoid using `onMount` or `$effect` for this. ## Each blocks