Vue JS keeps evolving and Vue JS 3 is the latest. Vue JS 3 and Vue JS 2 go along a similar line. However, there are significant changes in both. While Vue JS 3 has maintained some of the functionalities of Vue JS 2, some revolutionary changes have been incorporated. aTeamIndia is a team of developers that are well versed in all the versions of Vue JS. Some of the features that are changed or updated from version 2 are as follows.
- Service Code Architecture
The architecture has received a complete makeover. The very basis has been rewritten in order to make it neater and maintainable in its looks. It has been designed in such a way that developers can easily understand and also make their own contributions to this new version. For the purpose of making it less complex, internal functions have been disintegrated into smaller and individual packages. For instance, the observer module will come in its own package along with API and tests. However, this will not affect the API at the structural level. In this new version, the codebase is written with the help of typescript. aTeamIndia developers are well versed with typescript, type information and IDE support. This enables them to make contributions to the framework. Like mentioned above, now that the observer and the scheduler have a separate package, it is easier to work with new implementations.
- Observation Mechanism
Another major difference is in the reactivity of both the versions. On couples with an observer implementation that is supported on proxy, the new version can perform reactivity tracking with full language cover. This helps to solve many of the reactivity tracking problems faced by Vue 2. The new version has a debuggable reactivity tracking that is more efficient. Following features have also been introduced as a part of the observation mechanism:
- Exposed API
- Lazy observation by default
- Efficient debugging
- Immutable observables
Other Runtime Improvements
Other runtime improvements include a smaller codebase. It is designed to be “tree-shaking friendly”. It has also proved to be faster with better performance all across the framework. This is expected to reduce the booting time of the application by half its original time. Fragments and portals are supported by a built-in system. There is a slot mechanism in the new version which lets the developers keep track of changes in the level of components. This will prevent re-renders from happening.
High Level API Changes
A very surprising feature about the new version is that there have not been any groundbreaking API changes, although usually there will be with every upgrade. Everything has either remained the same or has been made to adapt with version 2. The template syntax is also the same with only some minor changes to scoped slots syntax. Developers can use API with native ES2015. This encourages components natively. Typescript will also get additional support. The component format of version 2 is also supported in the new version. Functional components will be plain functions except async components.