DEV Community


Discussion on: Using MobX with React Hooks

grizllym profile image
Michal Griessel • Edited

I have question.

TodoStore.js could create new Todos object and exports it. And index.js could simply import that store and use it (I test it and it works).

Is there any reason why use useContext if it works without it?

ryands17 profile image
Ryan Dsouza Author

Good question! If you're just going to deploy your React app as a static website i.e. client-side rendering, you can directly import the store instance it wouldn't make any difference, but for server-side rendering, passing the store via context is essential. I will also be making an example on server-side rendering with MobX