-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best way to combine stores in multiple files #228
Comments
You can combine multiple store creators into a single one to create a store. import createStoreA from '...'
import createStoreB from '...'
const useStore = create((set, get, api) => ({
...createStoreA(set, get, api),
...createStoreB(set, get, api),
})) Disclaimer: I didn't test it. |
Nice! Any idea how the types would work? |
Good question. I'd expect it would work with type annotation, but not sure if type inference would work. Please give it a try. |
It works! thanks. |
How did you make it work with types? |
Hello, I know this issue is closed, but I tried to follow the solution that seems to work for sepehr500 and I ended up with some errors. I started a thread on stackoverflow: |
@FlorianGoussin please create a discussion so I can help you on that thread |
Does anybody have a good way of combining multiple smaller stores in multiple files into a single store?
The text was updated successfully, but these errors were encountered: