How to have multiple instances of the same store in the same app? #3275
-
|
I am building a React Native application with a list/detail UX. Imagine a list of "Chats" then a user selects a chat and opens it. A single chat is complex enough that it warrants its own store. The main reason for breaking down stores is app start time and store hydration. Chats only grow in size and hydrating a single store with multiple large chat will slow down the app because eventually any React Native storage solution relies on On the face of it, There's a background socket that listens for messages on all chats and inserts new messages into the store. This happens even when the chat is not on the screen. So we need access to the store from within the I've got something to compile and it seemed to work but actually the persisted state gets reset (or ignored?) each time To summarise my questions, How can I create and share parametrised instances of a store? Approach example As mentioned, this always results in constantly receiving the initial state for the single chat store. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
The |
Beta Was this translation helpful? Give feedback.
The
mergeoption should help you to merge the current state with persisted state