I have a project set up in this way
+layout.svelte
+page.svelte
Component.svelte
The component lives in +layout.svelte
, because I need it also in nested routes. The component dispatches a custom event, which is handled by +layout.svelte
, but I need to do some actions also in +page.svelte
. How can I achieve something like this?
An idea would be to use a store: set the store in some state when the event is dispatched or handled in the +layout.svelte
, and listening for changes in +page.svelte
. But I wonder if there is a better approach?
I made a MWE here.
1