In my case I was struggling getting slug and the solution for reactivity was
slug
<script> import { page } from "$app/state"; let slug = $derived(page.params.slug); </script>