Skip to content
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

Multiple stores #9

Open
eiktyrner opened this issue Nov 15, 2016 · 5 comments
Open

Multiple stores #9

eiktyrner opened this issue Nov 15, 2016 · 5 comments

Comments

@eiktyrner
Copy link

Is it possible to use this package with multiple stores? Or do you need a "root" store like in your examples?
I'd rather not have just a single store available for injecting like your example export default observer(['store'], Gallery);

My current setup with ReactRouter is along these lines (from memory so syntax might be off..)

export {
  userStore,
  imageStore,
}
import * as stores from "stores"

<Provider {...stores}>  
    <Route />  
</Provider>, document.getElementById('root')

I couldn't get the startRouter to work with this type of setup. Any input?

@kitze kitze mentioned this issue Nov 25, 2016
@kitze
Copy link
Owner

kitze commented Nov 25, 2016

@eiktyrner Thanks for the suggestion. Right now I'm using a single store object for my mobx apps but you're right, this should be supported too. Also see the discussion in #12 👍

@LeonardoGentile
Copy link

@kitze Just right after having installed this I found the same problem as @eiktyrner.
Any update or workaround on this?

Thanks for sharing this by the way 👍 👍

@jayalfredprufrock
Copy link

For now I'm doing this and always injecting specific stores instead of the store collection.

<Provider store={stores} {...stores}>
   <MobxRouter />
</Provider>

@joshuaja
Copy link

I just ran into this as well. The generic MobX error made it a bit difficult to track down. Any plans to support a custom store name instead of requiring store?

@elilambnz
Copy link
Contributor

Combining multiple stores is recommended as best practice if you plan to have multiple stores.

Also, +1 for support to have a custom name instead of store.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants