Skip to content

docs: use $effect.pre instead of beforeUpdate #13955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions documentation/docs/06-runtime/03-lifecycle-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ While there's no "after update" hook, you can use `tick` to ensure that the UI i

```svelte
<script>
import { beforeUpdate, tick } from 'svelte';
import { tick } from 'svelte';

beforeUpdate(async () => {
$effect.pre(() => {
console.log('the component is about to update');
await tick();
console.log('the component just updated');
tick().then(
console.log('the component just updated');
);
});
</script>
```
Expand Down