Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1882

passing children's layout.ts data to parent's layout.svelte

$
0
0

So I have been working on the implementation of breadcrumbs feature in my sveltekit webapp.

  1. The idea is, the breadcrumb will be rendering at the most top layout.svelte.
  2. And then the proceeding descendants will somehow pass their breadcrumb data of itself to the parent.
  3. This is helpful when I have a [...rest] route somewhere.
  4. I managed to get it working. But i feel like there might be some better way to handle this.
  5. working example -> https://stackblitz.com/edit/sveltejs-kit-template-default-2o46jwja?file=src%2Froutes%2Ffolders%2F%5B...rest%5D%2F%2Bpage.svelte
  6. As you can see, im doing it using vanilla js. so the store is not reactive, since I iniatilized it in layout.ts. Meaning it will not be useful in storing reactive data later on.

Would be nice if someone can share their experiences if they encountered something similar like this.


Viewing all articles
Browse latest Browse all 1882

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>