Post

#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

0 reposts3 likes

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.

This is probably the best approach as of now. Although it feels a bit cumbersome to add a component for these usually tiny and specific use cases.