Tuple Logo
vue-js

SHARE

Vue.js

What is Vue.js?

Vue.js is an open source JavaScript framework for building user interfaces and single-page applications. Many developers simply call it Vue. Both names refer to the same framework.

Vue focuses on what the user sees: buttons, forms, lists and entire screens. You build an interface from separate components. Vue then makes sure the screen updates automatically whenever the data changes.

Evan You released Vue.js in 2014. He had previously worked with AngularJS at Google and wanted to create a lighter alternative that kept the parts he found most useful. Vue is released under the MIT licence, so you can use it for free, including in commercial projects.

There is no big tech company behind Vue. The project is run by a core team and supported by its community and sponsors.

What does progressive framework mean?

Vue describes itself as a progressive framework. This means you can adopt it step by step. You can use Vue for a single interactive element on an existing page. You can also use it to build a complete web application, with routing, state management and server-side rendering.

So there is no need to commit to everything at once. Start small, and you can expand later without switching frameworks.

What is Vue.js used for?

Vue.js is a versatile choice for the frontend of websites and web applications. You will often find it in these situations:

Well-known users include GitLab and Alibaba. Vue is also popular within the Laravel ecosystem in the PHP world.

How does Vue.js work?

Vue.js is built around three ideas: components, reactivity and templates. Together, they mean you write less code to keep the screen up to date.

Components

A component is a reusable building block of the interface, such as a button, a product card or a navigation bar. Each component has its own HTML, logic and styling. A large application is made up of a tree of components that fit together.

Components pass data to each other using props. A child component can send a signal back to its parent through an event. This keeps it clear where data comes from.

Reactivity

Reactivity is at the heart of Vue. You link data to the interface, and Vue keeps track of which parts of the screen depend on which data. When a value changes, Vue updates only those parts.

This means you do not have to change the page yourself with separate DOM operations. In Vue 3, this system relies on JavaScript Proxies, which notice whenever data is read or changed.

Templates and directives

In a template, you write ordinary HTML extended with special attributes. These attributes are called directives and start with v-. Double curly braces insert a value straight into the text, as in {{ name }}.

These are the directives you will use most often:

Virtual DOM

By default, Vue uses a virtual DOM. This is a lightweight copy of the page held in memory. When something changes, Vue compares the new version with the previous one and applies only the differences to the real page.

Vue gains extra speed here because its compiler analyses templates in advance. Parts that never change are skipped during updates. The Vue team is also working on Vapor Mode: an optional compilation mode that skips the virtual DOM entirely and updates the page directly.

Single-file components

In most Vue projects, you write components as single-file components (SFCs). An SFC is a file with the .vue extension that keeps the template, logic and styling together. A build tool such as Vite turns this file into code the browser understands.

A simple counter looks like this:

<script setup>
import { ref } from 'vue'

const count = ref(0)
</script>

<template>
  <button @click="count++">
    You clicked {{ count }} times
  </button>
</template>

<style scoped>
button {
  padding: 8px 16px;
}
</style>

The script block holds the logic. Wrapping the value in ref() makes count reactive. The template shows the value and increases it with every click. Thanks to scoped, the styling applies only to this component.

Options API and Composition API

Vue.js offers two ways to write a component's logic. They exist side by side, and you can use both in the same project.

Options API

The Options API is the classic approach from Vue 2. You organise a component into fixed sections, such as data, methods, computed and watch. This keeps small components tidy and is easy to learn.

export default {
  data() {
    return { count: 0 }
  },
  methods: {
    increment() {
      this.count++
    }
  }
}

Composition API

The Composition API arrived with Vue 3. Here, you write logic as plain functions, using helpers such as ref, computed and watch. In larger components, this lets you keep related code genuinely together.

<script setup>
import { ref, computed } from 'vue'

const count = ref(0)
const doubled = computed(() => count.value * 2)
</script>

A major advantage is reuse. You can move logic into its own function, known as a composable, and use it across multiple components. The Composition API also works better with TypeScript. That is why Vue recommends it for full applications built with a build tool.

The Vue.js ecosystem

One of the strengths of Vue.js is that its key tools are either officially maintained or closely aligned with the core team. You do not have to pick from dozens of separate packages yourself. These are the best-known parts:

There are also plenty of UI libraries with ready-made components, such as Vuetify, PrimeVue and Quasar.

Pros and cons of Vue.js

No framework is the best choice for every project. It helps to weigh up the strengths and weaknesses of Vue.js side by side.

Pros

Vue is known as one of the most approachable frameworks to start with. Its main advantages are:

Cons

There are also some points to bear in mind:

Vue.js vs React and Angular

Vue.js is often compared with React and Angular. All three are well suited to modern web applications, but their approaches differ considerably.

Vue.js

React

Angular

Type

Progressive framework

Library for the view layer

Full framework

Created by

Evan You and the community

Meta and the community

Google

Templates

HTML templates (JSX also possible)

JSX

HTML templates

Language

JavaScript or TypeScript

JavaScript or TypeScript

TypeScript

Routing and state

Official tools

Chosen from the community

Built in

Learning curve

Gentle

Moderate

Steep

React focuses purely on the interface, so you choose your own packages for routing and state management. Angular, by contrast, is a complete package with everything built in, but it takes longer to learn. Vue sits in between: lighter than Angular, with more official choices than React.

A short history of Vue.js

Evan You published the first version of Vue.js in February 2014. It started as a side project and grew into one of the most popular JavaScript frameworks in the world.

Vue 2 followed in 2016, introducing a virtual DOM and support for server-side rendering, among other things. This was the version that made Vue truly mainstream.

Vue 3 was released in September 2020. It brought the Composition API, a rewritten reactivity system and better TypeScript support. Vue 3 has been the default version since February 2022. Vue 2 reached the end of its official support on 31 December 2023.

A framework that grows with your project

Vue.js is an approachable and flexible framework for building user interfaces. Components, reactivity and templates form its foundation. You can start small with a single component and grow into a complete application with routing, state management and server-side rendering.

If you are looking for a framework that is quick to learn yet robust enough for large projects, Vue is a strong contender. If you want the largest ecosystem, React is the more obvious choice. If you prefer everything built in with a strict structure, Angular is a better fit.

Frequently Asked Questions
Is Vue.js a framework or a library?

Vue.js is a framework. Its core focuses on the view layer, much like a library. With the official tools for routing and state management, it grows into a complete framework. That is why Vue calls itself a progressive framework.


Is Vue.js free?

Yes. Vue.js is open source and released under the MIT licence. You can use it for free in both personal and commercial projects.


Is Vue.js hard to learn?

No, Vue is widely seen as one of the easiest frameworks to start with. If you know the basics of HTML, CSS and JavaScript, you can get going quickly. For larger projects, you will need to learn a few more topics, such as the Composition API, routing and state management.


What is the difference between Vue.js and Nuxt?

Vue.js is the framework for the interface itself. Nuxt is a meta-framework built on top of Vue. It adds features such as server-side rendering, static site generation and automatic routing, which help with SEO and fast loading times.


Can you use Vue.js with TypeScript?

Yes. Vue 3 is itself written in TypeScript and supports it fully. TypeScript works especially well with the Composition API.


Is Vue 2 still supported?

No. Vue 2 reached the end of its official support on 31 December 2023. It no longer receives updates or security fixes from the Vue team. New projects should use Vue 3.


Articles you might enjoy

Piqued your interest?

We'd love to tell you more.

Contact us
Tuple Logo
Veenendaal (HQ)
De Smalle Zijde 3-05, 3903 LL Veenendaal
info@tuple.nl‭+31 318 24 01 64‬
Quick Links
Customer Stories