What Does Vue 3.0 Mean for Web Development?

R_Alex

Well-known member
Nov 11, 2018
1,143
521
83
30
USA
www.russiancarders.se
#1
Last November, Vue creator, Evan You, showcased the key updates on Vue 3.0 — the latest iteration of the rising Javascript framework. These optimizations make Vue more efficient, modular, and easy to use. I will discuss these changes and the impact I believe they’ll have following Vue 3.0’s release.
What is Vue 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.
Vue is often seen as one of the more approachable and easy-to-implement frameworks. Allowing support for pure HTML templates whereas tools like React define DOM elements using Javascript.
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 continuously rising 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.


Source: TechMagicThe Biggest Changes in Vue 3.0
In his keynote, Evan You highlighted five key changes coming in Vue 3.0:

  1. Speed
  2. Size
  3. Maintainability
  4. Targeting Native
  5. Ease of Use
Now let’s explore these in depth.
Making Fast 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.
VueJS is already known for its render speed. In it’s 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 compile time hints that show code optimizations
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.
Monomorphic Calls — anyone who has taken a computer science class has had the concept of polymorphism hammered into their brains, but Vue 3.0 uses monomorphic calls in its rendering process. This micro-optimization always passes objects of the same shape to the render engine which makes it easier Javascript engines to optimize.


From Evan You’s Slides on Vue 3.0
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, does not re-render static elements that do not have any dependencies. This greatly reduces the work of the virtual DOM and saves a lot of project overhead.
Proxy Based Observations — Vue 3.0 will use ES2015 proxy-based observations in order to track element’s reactivity. Not only does this change eliminate the several cases that Vue 2.0 was not able to support, but it also performs a lot better. According to You, these optimizations can lead to 100% faster component instance initialization and, in comparison to 2.0,

Proxy Based Observations over double the speed, and half the memory usage than the Vue 2.0 observers.


Even 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.
Increasing Maintainability
Flow to TypeScript — to make it more accessible for more users, Vue 3.0 will transition from Flow to TypeScript. While the codebase will be rewritten to use Typescript, You made it clear that there was a heavy emphasis on making it compatible and easy to work with for people who don’t like using Typescript and would rather use pure Javascript.
Decoupling Packages — in comparison to its current state, Vue 3.0 is a muchmore 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.


Compiler Rewrite — this is one of the features that I’m most excited for. Not only do these changes allow for better IDE support, but now it creates source maps meaning that when there is a runtime error, it will give file location and line numbers of the error. If you work with Vue now, you know that a runtime error message is very little help in identifying the problem. This update should be a breath of fresh air developers.
Making it Easier to Target Native
Vue 3.0 will be platform agnostic — meaning that it will run pure Javascript and will not assume web features such as Node.js on its main build. This makes it easy to build applications for web, iOS, or Android because of the flexibility. By targeting native, Vue is making itself more of a comparable alternative to React that has tons of support for iOS and Android projects.
Making Developers’ Lives Easier
While a seemingly simple point, I think that this is the main pro of using VueJS — its simple, but powerful, capabilities. These were the aspects highlighted.
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.


So What?
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.
Speed. even now, VueJS provides faster render times than React or Angular. With the micro-optimizations that You discussed, it’s possible that Vue can have half the render times of the other frameworks. This is a key point that could draw some developers away from other environments. The table below shows the speed and memory advantage that Vue 2.0 already has — the new updates should improve these even more.


Source: Unicorn Supplies
Adaptability. 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.
Documentation. 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 scss, and Javascript, but it also comes with a decent amount of support and libraries for a relatively new framework. It’s super easy to jump in for new developers and is very scalable for advanced ones.
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. What are your thoughts on Vue 3.0 and the great Vue v. React v. Angular debate?

https://medium.com/@mattmaribojoc/18-useful-vuejs-ui-libraries-in-2019-1c622c6a4184
 

Log in

Online statistics

Members online
0
Guests online
38
Total visitors
38