Using Svelte 5 $state in Effects for HTTP Requests

Whats the most idiomatic way to read and write Svelte 5 $state
(for example let x = $state(0) in an Effect? Should I pass it as a Requirement? I did notice that I can directly read and write it in Effect.gen, but that seems impure/unidiomatic

for a bit more context, im writing an effect that every 5 seconds makes an http request and then want to see the latest version of it in the svelte UI
Was this page helpful?