8 up and 2 down, posted by xat 515 days ago 8 comments
React and redux have achieved their prominence by holding their resolve with the Node philosophy: do one thing and do it well. React provides us with natural language and tooling for composing declarative interfaces (be they web component, native UI elements, or experiments like react-music) without seeking to blur its own lines. You've got a view.
Redux establishes the same clear line: here lies the data. Either describe its changes, provoke them with middleware, or implement an alternative side effect model (redux-observable, redux-saga, and friends) but here is absolutely not the place for your view.
Redux without React is still a monumentally useful library that falls under the "simple but profound" umbrella, which is also true of React sans redux.
I highly doubt that Vue will manage to provide a superior model for both of these separate but foundational concerns. When one also considers that React and redux both excel in their composability and that neither library entails commitment to the other (to use React and Redux gains you two ecosystems of community support and development, neither married to the other), it seems to me that Vue will become another Angular (beloved and used wholly by very specific shops) with a few less trappings.
It looks clean enough, and as a library even quite nice, but in the bigger picture it is trying to solve answered questions with poor solutions: why are we trying to replace what has been effectively & elegantly decoupled with something monolithic?
Vue isn't strictly monolithic and is intended for the view layer, much like React. It can be sandwiched with Vuex, a Redux-like state library, for unidirectional data flow. By default, it uses a MobX-like approach to data binding (AFAIK MobX is influenced by Vue's default approach to binding, which is getter/setter based), and a pub/sub model for cross-component communication (not sure whether this has been retained in v2.x). It's seldom that we see React without either Redux or MobX, so making these tools/methodologies first-party makes sense.
Vue's drawcard, for me at least, is its tiny size. Last year, I built out a rather large app using Vue < 1.0, and found that the whole thing came in under the gzipped size of React alone (with no additional tools like Redux or React Router).
Fair enough on the first point: I am perhaps too much of a purist with separating concerns. It's not enough to put me off of trying Vue.
The size difference is very impressive ... if you don't mind, about how complex was your finished app and how large was the bundle versus something similar you have done with a React (and friends) based app?
Interesting article! I personally prefer the React way for serveral reasons. What hinders me to give vue a try is the seperation of HTML and JS. In Vue (it seems) you have to use a CSS selector to wire things together ("#journal" in the example).
Everyone should use what fits them best, but I don't want to ever again use Strings (here CSS selectors) to "bring things together". Maybe it's the Java background but something feels so very wrong about this to me (though there are also many examples of inappropriate String usage in Java, instead of using types).
You can pass a DOM element instead of a selector there. It's just like ReactDOM.render, only you can pass a selector too.
Plus you can pass a template property too so it won't use the element's content as a template.
Moreover, with Vue you can create .vue files that merge together the code, the template and the style of a single component. As a plus, you can use transpilers and compilers for all (Babel, Pug, Sass... you name it).
Finally you can even use JSX with Vue so you actually have maximum flexibility here.
The nice thing about vuejs is, that you can also just define a render method and use JSX. So you don't have to use template strings.
Thanks, now i need to take a closer look ;-)
I had a deeper look at vuejs a few weeks back and I really enjoyed it.
It's like the best parts of React, MobX and Angular have been mixed together, surrounded by a nice, clean and simplistic API.