First of all, you need to setup ctx
for svelte context in your root component.
We recommend to add logger for dev environment, from @reatom/logger directly, or from @reatom/framework.
Than you can bind subscribe
and set
(for mutable atoms) to your atoms by withSvelte
and use it as a store.
IMPORTANT, use withSvelte
only in component script
tag, as it reads the context.
Of course, you could describe atoms as a separate module and bind actions with the same withSvelte(anAction).set
.
repl↗.
Data fetching and Svelte
#
https://svelte.dev/repl/0613e23e6aa74246afad6d726d6c5a33?version=3.55.0↗