Tips, tricks and thoughts on hot topics in the digital industry | Globalia

Why upgrade to Vue.js version 3?

Written by Yannick Bisaillon | Nov 27, 2023 8:00:00 AM

As we all know, it's not easy to update the technological stack of certain projects. Nevertheless, it's often an essential step in keeping up to date with the latest developments in the field, and improving both the user and developer experience. If you use Vue.js, it's your turn to take the leap: Vue 2 will stop providing security updates on December 31, 2023.

What is Vue 3?

The Vue 3 framework has been rewritten from the ground up to deliver improved performance and TypeScript support, all at a fraction of the weight of its previous version. Quite impressive, this new version gives us the tools to deliver better quality projects with the latest technology.

 

A Summary of the Improvements in Vue 3

1. API Composition

API composition is a game-changer when it comes to organizing and reusing certain aspects of code. This feature enables component logic to be extracted and reused across multiple components. This improves both readability and code maintenance. Thanks to its declarative syntax, it also enables Vue's reactive system to better track changes and update states. The result is code that's better organized, easier to maintain and more efficient.

2. Portals

The native support of portals, called Teleport, is very useful for elements such as modals, dialogs, overlays, alerts and so on. It's a native component that allows you to teleport part of your code to a DOM node that exists outside the hierarchy.

3. Fragments

A virtual element that won't be rendered in the DOM, this is very practical for cleaner HTML rendering. No more unnecessary tags around our components.

4. TypeScript

Vue 3 also offers greatly enhanced support for TypeScript, a programming language that is very popular for building stronger projects with a typed code base. It's a more rigid language than JavaScript. It allows problems to be identified upstream. It also provides better code security, maintenance and documentation. With the new version, it's now very easy to use this technology in Vue.

5. Suspense

Suspense is a special component for displaying fallback content until the condition is met. It's mainly used to display fake content or a loading bar in latency times. An essential element for a good user experience.

6. CSS Variables

The implementation of CSS variables influenced by states allows you to visually change certain aspects of the user interface in relation to state changes. A feature that developers will love, it opens the door to many possibilities for CSS management.

 

The End of Vue 2 is Near

It's not yet urgent to upgrade to the new version, but you should start thinking about it seriously. Vue 3 was officially launched on September 18, 2020 and has been considered the default version since February 7, 2022. 

Vue 2 will reach "End-of-Life (EoL)" on December 31, 2023. That's a date you'll want to remember, as security updates will stop at that point. For a hassle-free transition, start your preparations now. You can find out more about the end of Vue 2 on the Vue.js website.



The Vue Ecosystem

When we have a major technological update, it's the entire ecosystem that has to be updated. In the case of Vue, the community reacted quickly, and several libraries were already ready to offer updates to their tools to support the new Vue version.

Nuxt 3

Nuxt is a powerful tool offering solid conventions, server rendering for better SEO and many other features.

Here are just a few of the features:

  1. The New Server Engine (Nitro)
  2. Zero Configuration
  3. File-system Routing
  4. Rendering Modes
  5. Data Fetching
  6. Strong Conventions
  7. SEO Friendly
  8. Components Auto-import
  9. Modules Ecosystem



In short, it's Time to Update to Vue 3!

Vue 3 gives you access to a wide range of exciting new features for building high-performance, modern projects. It's a complete ecosystem in transition. If your site uses Vue 2, it's important to start analyzing the work required to make the transition. Don't forget that Vue 2 will stop providing security updates on December 31, 2023! Hurry up and talk to an expert to switch to Vue 3.