What is VueJS Right Now?
In their own words, Vue is a “progressive framework for building user applications”. It’s designed to be super flexible with the ability to either incorporate individual Vue libraries into other projects or powering complex projects entirely with Vue.
As of early 2019, we are still in Vue 2.0. While still holding a tiny share of the market in comparison to React and Angular, Vue has been continuouslyrising in popularity. In my opinion, the release of Vue 3.0 will boost its usage and make it even more of a legitimate alternative to the other major frameworks.
Below is a graph showing the number of job availabilities for each framework. As you can see, VueJS still as a ways to go before coming close to the current industry standards.
The Biggest Changes in VueJS 3.0
In his keynote, Evan You highlighted five key changes coming in Vue 3.0:
- Targeting Native
- Ease of Use
Now let’s explore these in depth.
Making VueJS Even Faster
This topic took up a large portion of You’s talk as it has the most technical changes and is clearly one of Vue’s major selling points nowadays.
Developers already know VueJS for its render speed. In its comparison tests, it outperforms other frameworks. However, the number of edge cases and fixes made to the 2.0 code made the Vue team decide to completely rewrite the rendering code using micro-optimizations. According to You, these optimizations can create up to a 100% increase in mounting and initialization speed.
VueJS, like other frameworks, uses a virtual DOM to render its components. In order to speed up the rendering process, the workload of this virtual DOM has to be reduced. 3.0 includes the following features to meet this goal:
Compile Time Hints
By overhauling the rendering process, Vue 3.0 will output better
Component Fast Path
Instead of checking if a template object is a component, Vue 3.0 will make the assumption that capitalization marks a component. This assumption takes out the guesswork and speeds up the render process.
Optimized Slots Generation
This seemingly complex term actually boils down to a simple concept: making sure dependencies are tracked by the instances that use them. Currently, whenever either a parent and child component has an updated dependency, both are forced to re-render. However, in 3.0, the parent and child would have different dependencies and will only update when their respective dependencies change. This drastically reduces the number of re-renders that occur on a page.
Static Tree Hoisting
While this is not new (it exists in Vue 2.0), static tree hoisting greatly improves project speeds. As the name suggests, it
Proxy Based Observations
Vue 3.0 will use ES2015 proxy-based observations in order to track
Proxy Based Observations over double the speed, and half the memory usage than the Vue 2.0 observers.
VueJS 3 is More Lightweight
Currently, VueJS is already small (20 kb gzipped). However, thanks to tree shaking (eliminating non-vital code), the estimated size for 3.0 is roughly 10 kb gzipped. This is by removing all libraries that are non-essential for a Vue project and having them available through import statements instead of packed in the main src.
Flow to TypeScript
In comparison to its current state, Vue 3.0 is a much more modular experience that relies on its own internal packages in order to run. This makes it customizable and flexible while also giving it transparency that will allow developers to really get into the source code.
This is one of the features that I’m most excited
Making it Easier to Target Native
Making Vue Developers’ Lives Easier
While a seemingly simple point, I think that this is the main pro of using VueJS —
Exposing the Reactivity API
The new changes will give devs the ability to explicitly create reactive objects. As well as creating custom re-render hooks. 3.0 also addresses a common complaint of VueJS users: When and why the hell is my component re-rendering?
Now there is a renderTriggered event that allows people to see what is triggering the update. A fantastic feature that will give VueJS even more transparency.
Edit (Dec 2019): this is now called the Composition API and is available to try in Vue2 projects.
You may be thinking, “So what? People are still going to use React or Angular.” and you may be right. As the current industry standards, React and Angular will likely continue to be the most popular options for component frameworks. However, there are a few interesting things to discuss in Vue 3.0 that may make it more of a competitive alternative in the coming years.
Even now, VueJS provides faster render times than React or Angular
VueJS is designed to be easy to implement. Whether you want to add it to an existing project or use it to power a SPA, there is a lot of documentation and use cases that help define your needs. The changes made in Vue 3.0, especially exposing the reactivity hooks and a new modular design, make this already flexible language even more powerful. While I’ll go on to highlight the simplicity of VueJS, there are so many features that allow more technical and experienced devs to take full control of their project.
This may be a “me issue”, but I personally find Vue’s documentation 10x easier to understand than React’s. In fact, I’ve never even had to complete a Hello World Tutorial or anything in Vue. The documentation was enough for me to understand my usage case and get started. You can take a look for yourself.
Difficulty (or lack thereof)
Like I was talking about the documentation — Vue is super approachable. Not only does it use natural HTML, CSS/CSS preprocessors like sass and
To see the full impact of Vue 3.0, we’ll have to wait until its release sometime (hopefully) in 2019. The features that Evan You showed off at VueConf Toronto seem to make Vue more powerful and efficient, so my hopes are high for the new release.