Closed vincent911001 closed 2 years ago
Hi @vincent911001 ,
You can just instantiate multiple stores, e.g.:
const store1 = syncedStore({ todos: [] as Todo[] }); const store2 = syncedStore({ todos: [] as Todo[] });
Make sure to register a sync provider (e.g.: WebRtcProvider) for both of them
Of course, you can also register two todos arrays on a single store. The benefit of using multiple store is that data is synced per store, so it saves data + processing time if a user only needs to sync 1 todo list (the user then only needs to open 1 of the 2 stores). Also, you can manage sync providers per store.
Thanks @YousefED.
I am using zustand store to keep them globally.
@vincent91001, can you explain me your solution? Thank you very much!!!
Hi,
How can we instantiate multiple SyncedStore for multiple To Do list instead of creating one Global store?
Thanks, Vincent