SolidJSS
SolidJSโ€ข3y agoโ€ข
7 replies
oneiro

createResource as initial value with store

Hi,

is there a way to combine the behaviour of createResource and createStore? What I essentially want to achieve, is to fetch a resource and populate a store with the data. But since doing something like this with
createEffect
I was wondering, what the best way to do this would be?

Essentially the flow should be:
Fetch data from a local save file -> use this as (almost) initial value for a store -> interact with the store (e.g. change values) and later write it back.

A
createMemo
wouldn't really make sense in that case, as there isn't really any form of derived state.

Any tips on what the best idiomatic way to achieve this in solid would be?

Thanks in advance ๐Ÿ™‚ l
Was this page helpful?