3 ms·
Yes this is the way to do it, global-ish state files with getters and setters. I’ll have a .svelte.ts file (or a few of them) with a typed state object, maybe a
by jmogly 1y ago
Yes this is the way to do it, global-ish state files with getters and setters. I’ll have a .svelte.ts file (or a few of them) with a typed state object, maybe a function for refreshing it or syncing it with a backend api, import the state all over the place.
Might be an anti pattern but it works really well.
- mhh__ 1y agoI think I follow but IIRC my problem was something like that the getters and setters had to be quite "flat". if they weren't they would recursively infect everything top-down and then not work anyway because of boundaries in the deep reactivity.