# Vue.js

Vue.js (commonly referred to as Vue; pronounced "view") is an open-source model–view–viewmodel front end JavaScript framework for building user interfaces and single-page applications. It was created by Evan You and is maintained by him and the rest of the active core team members.

## Overview

Vue.js features an incrementally adaptable architecture that focuses on declarative rendering and component composition. The core library is focused on the view layer only. Advanced features required for complex applications such as routing, state management and build tooling are offered via officially maintained supporting libraries and packages.
Vue.js allows for extending HTML with HTML attributes called directives. The directives offer functionality to HTML applications, and come as either built-in or user defined directives.

## History

Vue was created by Evan You after working for Google using AngularJS in several projects. He later summed up his thought process: "I figured, what if I could just extract the part that I really liked about Angular and build something really lightweight." The first source code commit to the project was dated July 2013, at which time it was originally named "Seed". Vue was first publicly announced the following February, in 2014.
Version names are often derived from manga and anime series, with the first letters arranged in alphabetical order.

### Versions

| Version | Release date | Title | End of LTS | End of Life |
| 3.5 | September 1, 2024 | Tengen Toppa Gurren Lagann | | |
| 3.4 | December 28, 2023 | Slam Dunk | | |
| 3.3 | May 11, 2023 | Rurouni Kenshin | | |
| 3.2 | August 5, 2021 | Quintessential Quintuplets | | |
| 3.1 | June 7, 2021 | Pluto | | |
| 3.0 | September 18, 2020 | One Piece | | |
| 2.7 | July 1, 2022 | Naruto | December 31, 2023 | December 31, 2023 |
| 2.6 | February 4, 2019 | Macross | March 18, 2022 | September 18, 2023 |
| 2.5 | October 13, 2017 | Level E | | |
| 2.4 | July 13, 2017 | Kill la Kill | | |
| 2.3 | April 27, 2017 | JoJo's Bizarre Adventure | | |
| 2.2 | February 26, 2017 | Initial D | | |
| 2.1 | November 22, 2016 | Hunter X Hunter | | |
| 2.0 | September 30, 2016 | Ghost in the Shell | | |
| 1.0 | October 27, 2015 | Evangelion | | |
| 0.12 | June 12, 2015 | Dragon Ball | | |
| 0.11 | November 7, 2014 | Cowboy Bebop | | |
| 0.10 | March 23, 2014 | Blade Runner | | |
| 0.9 | February 25, 2014 | Animatrix | | |
| 0.8 | January 27, 2014 | — | first version publicly announced | first version publicly announced |
| 0.7 | December 24, 2013 | — | | |
| 0.6 | December 8, 2013 | VueJS | | |
When a new major is released i.e. v3.y.z, the last minor i.e. 2.x.y will become a LTS release for 18 months (bug fixes and security patches) and for the following 18 months will be in maintenance mode (security patches only).

## Features
### Components

Vue components extend basic HTML elements to encapsulate reusable code. At a high level, components are custom elements to which the Vue's compiler attaches behavior. In Vue, a component is essentially a Vue instance with pre-defined options. The code snippet below contains an example of a Vue component. The component presents a button and prints the number of times the button is clicked:

### Templates

Vue uses an HTML-based template syntax that allows binding the rendered DOM to the underlying Vue instance's data. All Vue templates are valid HTML that can be parsed by specification-compliant browsers and HTML parsers. Vue compiles the templates into virtual DOM render functions. A virtual Document Object Model (or "DOM") allows Vue to render components in its memory before updating the browser. Combined with the reactivity system, Vue can calculate the minimal number of components to re-render and apply the minimal amount of DOM manipulations when the app state changes.
Vue users can use template syntax or choose to directly write render functions using hyperscript either through function calls or JSX. Render functions allow applications to be built from software components.

### Reactivity

Vue features a reactivity system that uses plain JavaScript objects and optimized re-rendering. Each component keeps track of its reactive dependencies during its render, so the system knows precisely when to re-render, and which components to re-render.

### Transitions

Vue provides a variety of ways to apply transition effects when items are inserted, updated, or removed from the DOM. This includes tools to:
* Automatically apply classes for CSS transitions and animations
* Integrate third-party CSS animation libraries, such as Animate.css
* Use JavaScript to directly manipulate the DOM during transition hooks
* Integrate third-party JavaScript animation libraries, such as Velocity.js
When an element wrapped in a transition component is inserted or removed, this is what happens:
* Vue will automatically sniff whether the target element has CSS transitions or animations applied. If it does, CSS transition classes will be added/removed at appropriate timings.
* If the transition component provided JavaScript hooks, these hooks will be called at appropriate timings.
* If no CSS transitions/animations are detected and no JavaScript hooks are provided, the DOM operations for insertion and/or removal will be executed immediately on next frame.

### Routing

A traditional disadvantage of single-page applications (SPAs) is the inability to share links to the exact "sub" page within a specific web page. Because SPAs serve their users only one URL-based response from the server (it typically serves index.html or index.vue), bookmarking certain screens or sharing links to specific sections is normally difficult if not impossible. To solve this problem, many client-side routers delimit their dynamic URLs with a "hashbang" (#!), e.g. page.com/#!/. However, with HTML5 most modern browsers support routing without hashbangs.
Vue provides an interface to change what is displayed on the page based on the current URL path – regardless of how it was changed (whether by emailed link, refresh, or in-page links). Additionally, using a front-end router allows for the intentional transition of the browser path when certain browser events (i.e. clicks) occur on buttons or links. Vue itself doesn't come with front-end hashed routing. But the open-source "vue-router" package provides an API to update the application's URL, supports the back button (navigating history), and email password resets or email verification links with authentication URL parameters. It supports mapping nested routes to nested components and offers fine-grained transition control. With Vue, developers are already composing applications with small building blocks building larger components. With vue-router added to the mix, components must merely be mapped to the routes they belong to, and parent/root routes must indicate where children should render.
The code above:
* Sets a front-end route at websitename.com/user/<id>.
* Which will render in the User component defined in (const User...)
* Allows the User component to pass in the particular id of the user which was typed into the URL using the $route object's params key: $route.params.id.
* This template (varying by the params passed into the router) will be rendered into <router-view></router-view> inside the DOM's div#app.
* The finally generated HTML for someone typing in: websitename.com/user/1 will be:

## Ecosystem

The core library comes with tools and libraries both developed by the core team and contributors.

### Official tooling

* Devtools – Browser devtools extension for debugging Vue.js applications
* Vite – Standard Tooling for rapid Vue.js development
* Vue Loader – a webpack loader that allows the writing of Vue components in a format called Single-File Components (SFCs)

### Official libraries

* Vue Router – The official router, suitable for building SPAs
* Pinia – The official state management solution

### Video Courses

* Vue School – Expert-led courses on Vue.js and its ecosystem.

## Comparison with other frameworks

JavaScript-based web application frameworks, such as Vue, provide extensive capabilities but come with associated trade-offs. These frameworks often extend or enhance features available through native web technologies, such as routing, component-based development, and state management. While native web standards, including Web Components, modern JavaScript APIs like Fetch and ES Modules, and browser capabilities like Shadow DOM, have advanced significantly, frameworks remain widely used for their ability to enhance developer productivity, offer structured patterns for large-scale applications, simplify handling edge cases, and provide tools for performance optimization.
Frameworks can introduce abstraction layers that may contribute to performance overhead, larger bundle sizes, and increased complexity. Modern frameworks, such as Vue 3, address these challenges with features like concurrent rendering, tree-shaking, and selective hydration. While these advancements improve rendering efficiency and resource management, their benefits depend on the specific application and implementation context. Lightweight frameworks, such as Svelte and Preact, take different architectural approaches, with Svelte eliminating the virtual DOM entirely in favor of compiling components to efficient JavaScript code, and Preact offering a minimal, compatible alternative to React. Framework choice depends on an application’s requirements, including the team’s expertise, performance goals, and development priorities.
A newer category of web frameworks, including enhance.dev, Astro, and Fresh, leverages native web standards while minimizing abstractions and development tooling. These solutions emphasize progressive enhancement, server-side rendering, and optimizing performance. Astro renders static HTML by default while hydrating only interactive parts. Fresh focuses on server-side rendering with zero runtime overhead. Enhance.dev prioritizes progressive enhancement patterns using Web Components. While these tools reduce reliance on client-side JavaScript by shifting logic to build-time or server-side execution, they still use JavaScript where necessary for interactivity. This approach makes them particularly suitable for performance-critical and content-focused applications.