Skip to content

Commit 430c2bb

Browse files
docs: use $effect.pre instead of beforeUpdate (#13955)
* Update 03-lifecycle-hooks.md * Update documentation/docs/06-runtime/03-lifecycle-hooks.md Co-authored-by: Paolo Ricciuti <[email protected]> --------- Co-authored-by: Paolo Ricciuti <[email protected]>
1 parent ac6d8c0 commit 430c2bb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

documentation/docs/06-runtime/03-lifecycle-hooks.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ While there's no "after update" hook, you can use `tick` to ensure that the UI i
6767

6868
```svelte
6969
<script>
70-
import { beforeUpdate, tick } from 'svelte';
70+
import { tick } from 'svelte';
7171
72-
beforeUpdate(async () => {
72+
$effect.pre(() => {
7373
console.log('the component is about to update');
74-
await tick();
75-
console.log('the component just updated');
74+
tick().then(
75+
console.log('the component just updated');
76+
);
7677
});
7778
</script>
7879
```

0 commit comments

Comments
 (0)