mobxjs / mobx

Simple, scalable state management.
http://mobx.js.org
MIT License
27.46k stars 1.77k forks source link

[Feature] Mobx-vue/Mobx-riot package #549

Closed matuscongrady closed 7 years ago

matuscongrady commented 8 years ago

Hello,

First off, thanks for Mobx, in my eyes, it's a great improvement over flux and redux.

What I was thinking, is that I kinda don't need anything that React brings to the table. I think that in a real-life project that manages state outside of components, I'm using less than 20% of what React has to offer.

So my suggestion would be to use more lightweight "view" implementation, such as Vue 2 or Riot.js instead of React.

Here are some benefits I can think of:

  1. Performance: from what I've heard and read, both Vue 2 and Riot does have better performance than React
  2. Better separation of concerns:
  3. Syntax is more clear: (just an oppinion) - I really dont like iterating over and array with { this.props.data.map(item => ...) } or conditionally rendring element with{ (condition) ? <Element /> : null }
  4. Library size

Is there any plan of making mobx-vue or mobx-riot library? Or is there a convenient way to use those libraries without a mobx bridge?

Thank you. Any suggestions or oppinions on this are much appreciated.

evoyy commented 8 years ago

So my suggestion would be to use more lightweight "view" implementation, such as Vue 2 or Riot.js instead of React.

Some of us are happy with React and have no desire to change. As for the benefits you mention and the fact that you are only using 20% of what React has to offer... think about when your app grows in size or complexity and then needs the extra functionality, and how much of React's functionality you will then have to re-invent in your lightweight framework.

However, MobX does not depend on React. It can be used with (or without) any framework. I don't know Riot or Vue, but I think it would not be hard to create bindings, similar to the mobx-react package. I think at a high level the bindings are just helpers based around observable() and autorun().

mweststrate commented 8 years ago

I personally have no intention to create those bindings, but I think it should be pretty doable. Creating your own bindings should be pretty straight forward, see for example https://github.com/nightwolfz/mobx-inferno/issues or https://github.com/micnews/mobx-deku. This is the important part in mobx-react: https://github.com/mobxjs/mobx-react/blob/master/src/observer.js#L63. The rest of the code base is basically dev tool support or react specific stuff (propTypes, Provider etc). If you intend to create bindings and you have any questions regarding details feel free to use the gitter channel as well.

mweststrate commented 7 years ago

Closing this one for now, but anybody is free to pick things like these up ;)