Dynamic Svelte Component State Management

MaksimApril 6, 2026 at 8:39 PM

I create a a page in the parent component depending on the incoming properties, the subsidiary components depend on it at varying depths (<a href="https://github.com/ravecat/song/yblob/master/assets/js/components/timer.svelte#L4" target="blank"="relnofollow noopener noreferrer">for example and options outside the context).

Дмитрий ДинApril 6, 2026 at 8:45 PM
MaksimApril 6, 2026 at 8:46 PM

What a minute?

Дмитрий ДинApril 6, 2026 at 8:46 PM

Here I am talking not only about dynamic stores, but also about creating a count based on subscriptions.

MaksimApril 6, 2026 at 8:47 PM

What does this have to do with my question?

Дмитрий ДинApril 6, 2026 at 8:49 PM

By resolving a similar issue, but with a focus on derivative states still. The overall state I scattered between components using the singleton class, which I recorded in context

MaksimApril 6, 2026 at 8:50 PM

I don’t know how this differs from the usual context.

Дмитрий ДинApril 6, 2026 at 8:51 PM

So you can import this class and save types to get the desired status, instead of manually extracting through getContext with type loss and dop checks.

MaksimApril 6, 2026 at 8:53 PM

The context is typed from recent versions of the

Дмитрий ДинApril 6, 2026 at 8:53 PM

Why not use it directly?

MaksimApril 6, 2026 at 8:54 PM

I use it.

Микита ТарановApril 6, 2026 at 8:52 PM

What does not fit the context?

MaksimApril 6, 2026 at 8:56 PM

suits, works, only tests turn into the need for a mock getter or import a setter with the creation of envelopes. implementation proceeds into tests, although in the dock something like this as an example are given https://svelte.dev/docs/svelte/context#Component-testing, thought I missed something