#Svelte folks, I find myself quite often declaring some kind of state (map of booleans or map of dom refs) that is only ever relevant for a single each block. Can I somehow declare this state only within that particular each block? repl: svelte.dev/playground/h... cc @paolo.ricciuti.me
Post
There's nothing like this but this also feels way to niche to add a whole new concept. If you really want to remove one variable you could use an object in the array instead of the string like this svelte.dev/playground/0...
svelte.deveach block scoped state • Playground • SvelteWeb development for the rest of us
Good call but I would like to prevent cluttering my data with some UI state. Interesting to hear that you think having block scoped state is too niche for a new concept. I find myself needing this quite often, e.g. for a loading state in an each block. Smth like {@let ...} would be quite helpful.
0 reposts2 likes
No replies yet.