Eric
Eric

Reputation: 24880

Svelte: is there a way to modify property in layout file from a slot component or from a parent layout?

In routes/home/__layout.svelte, there is a variable:

let activeId;

Is it possible to modify the activeId from:

  1. routes/home/content.svelte, which will use the above layout.
  2. routes/__layout.svelte, which is a parent layout of the above layout.

Upvotes: 1

Views: 749

Answers (1)

brunnerh
brunnerh

Reputation: 184376

I would probably just use a store that is made available through a context that is set in the root layout.

Upvotes: 2

Related Questions