vuejs
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
About Vue.js<br />
v<br />
React<br />
React and Vue.js do share a similarity in that they both provide reactive & composable View<br />
components. There are, of course, many differences as well.<br />
First, the internal implementation is fundamentally different. React’s rendering leverages the Virtual<br />
DOM - an in-memory representation of what the actual DOM should look like. When the state<br />
changes, React does a full re-render of the Virtual DOM, diffs it, and then patches the real DOM.<br />
The virtual-DOM approach provides a functional way to describe your view at any point of time,<br />
which is really nice. Because it doesn’t use observables and re-renders the entire app on every update,<br />
the view is by definition guaranteed to be in sync with the data. It also opens up possibilities to<br />
isomorphic JavaScript applications.<br />
Instead of a Virtual DOM, Vue.js uses the actual DOM as the template and keeps references to<br />
actual nodes for data bindings. This limits Vue.js to environments where DOM is present. However,<br />
contrary to the common misconception that Virtual-DOM makes React faster than anything else,<br />
Vue.js actually out-performs React when it comes to hot updates, and requires almost no handtuned<br />
optimization. With React, you need to implement shouldComponentUpdate everywhere or<br />
use immutable data structures to achieve fully optimized re-renders.<br />
API-wise, one issue with React (or JSX) is that the render function often involves a lot of logic, and<br />
ends up looking more like a piece of program (which in fact it is) rather than a visual representation<br />
of the interface. For some developers this is a bonus, but for designer/developer hybrids like me,<br />
having a template makes it much easier to think visually about the design and CSS. JSX mixed with<br />
JavaScript logic breaks that visual model I need to map the code to the design. In contrast, Vue.js<br />
pays the cost of a lightweight data-binding DSL so that we have a visually scannable template and<br />
with logic encapsulated into directives and filters.<br />
Another issue with React is that because DOM updates are completely delegated to the Virtual DOM,<br />
it’s a bit tricky when you actually want to control the DOM yourself (although theoretically you<br />
can, you’d be essentially working against the library when you do that). For applications that needs<br />
ad-hoc custom DOM manipulations, especially animations with complex timing requirements, this<br />
can become a pretty annoying restriction. On this front, Vue.js allows for more flexibility and there<br />
are multiple FWA/Awwwards winning sites² built with Vue.js.<br />
Some additional notes:<br />
• The React team has very ambitious goals in making React a platform-agnostic UI development<br />
paradigm, while Vue is focused on providing a pragmatic solution for the web.<br />
• React, due to its functional nature, plays very well with functional programming patterns.<br />
However it also introduces a higher learning barrier for junior developers and beginners. Vue<br />
is much easier to pick up and get productive with in this regard.<br />
²https://github.com/<strong>vuejs</strong>/vue/wiki/Projects-Using-Vue.js#interactive-experiences