destroy store zustand #3050
-
Hi guys, I started developing an app using state manager. So I have this question: I have different pages in my app. Each page has its own store with its own slides. If I navigate between pages, my app saves all the state. Is it possible to somehow destroy the store from memory, because on page 1 I don't need to use the store from page 2. It turns out that it just takes up some memory. I was looking for a solution to this but couldn't find it. Is there any solution to this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You can dynamically create stores we do have some examples on createStore api docs |
Beta Was this translation helpful? Give feedback.
@1bobofett1 well, that implementation is wrong due to the naming is wrong but the you can create dynamically stores and use
.setState(undefined)
to "destroy" themBTW, you need to read the docs we talked about that and other scenarios in the docs