How to initialize a store from another store?
I'd like to initialize a store (say
store2) from another store (say store1).
However if I change store2, I don't want it to affect store1.
In the example below, I tried using unwrap but that didn't help: when a value in store2 changes, it affects store1.
https://playground.solidjs.com/anonymous/b623bc24-5945-4676-a5cd-708584f6a2cc4 Replies
use
JSON.parse(JSON.stringify(v)), structuredClone or anything that clones deeplyoh it's that problem again, alright 😄 thank you!
@mdynnl would you know why
unwrap was not sufficient here?unwrap only unwraps the proxy
and store modifies the object
so you can't really use the same object for multiple stores without deep-cloning