← Dashboard

web development / vue

Learn Vue.js for Free: Reactivity, Single-File Components and the Official Tutorial

Vue is quick to start and easy to misuse if you skip how reactivity works. This guide covers what create-vue sets up, the three reactivity tools that matter first, and a tested single-file component that you can paste into a new project.

updated Nov 2026·a 11-minute read·code run on Vue 3.5 and Vite

Vue is a JavaScript framework for building user interfaces, and its learning curve is gentle at the start. You can drop a script tag on a page and have a working counter in minutes. That ease is also the trap: people who learn Vue by copying snippets never build a mental model of what makes the page update, and the model is the whole skill.

This page starts with the official project setup, then spends most of its time on reactivity. The code here uses the Composition API with script setup, which is what the official quick start generates, so what you learn matches what you will find in new projects.

01 · SETUP

What create-vue gives you, and what to say no to

The Vue quick start uses create-vue, the official scaffolding tool, which sets up a Vite-based build with Single-File Components. The page lists Node.js version ^22.18.0 || >=24.12.0 as the prerequisite, so check node --version first. Then run the command below and answer the prompts.

terminalshell
npm create vue@latest
cd <your-project-name>
npm install
npm run dev

The tool asks about optional features: TypeScript, Vue Router, Pinia, Vitest, an end-to-end testing solution, ESLint and Prettier. The quick start says that if you are unsure, choose No.

Which prompts to accept as a beginner
PromptSayReason
TypeScriptNo at firstLearn Vue's ideas before adding a type system
Vue RouterNo for the first projectA single-screen app does not need routing yet
PiniaNoShared state is only worth adding when two distant components need the same data
VitestYes, once you are ready to testComponent tests are how you learn to trust reactivity
ESLint and PrettierYesThey catch mistakes and end style arguments
WATCHWithout a build step you cannot use SFC syntax. The quick start notes that CDN usage does not support Single-File Components, so tutorials that use a script tag and your create-vue project look different. Pick one style per project.

02 · REACTIVITY

ref, computed and when each one fits

Vue re-renders what depends on reactive data when that data changes. The Reactivity Fundamentals page of the official guide is the best explanation, and these are the three tools you meet first.

The reactivity tools in order of use
ToolUse it forExample
refA value that changes and the page should reactconst query = ref('')
computedA value derived from other reactive valuesFiltered list from a search box
watchA side effect when data changes, such as saving or fetchingFetch results when an id changes

The most common mistake is to use watch or a second ref for something you could compute. The component below keeps a single source of truth, the query, and derives the visible list from it.

03 · A WORKED EXAMPLE

A searchable list as a single-file component

App.vueVue 3 SFC
<script setup>
import { ref, computed } from 'vue'

const trails = ['Ridge loop', 'River path', 'Summit spur']
const query = ref('')

// recalculated only when query changes; never stored by hand
const visible = computed(() =>
  trails.filter((t) => t.toLowerCase().includes(query.value.toLowerCase()))
)
</script>

<template>
  <label>Search <input v-model="query" /></label>
  <ul>
    <li v-for="t in visible" :key="t">{{ t }}</li>
  </ul>
  <p>{{ visible.length }} of {{ trails.length }} shown</p>
</template>

This was built with Vite and the Vue plugin on Vue 3.5.44 and loaded in Chromium. It starts at "3 of 3 shown". Typing ri leaves Ridge loop and River path with "2 of 3 shown", and typing zzz leaves no items and "0 of 3 shown", with no console errors.

Notice that inside script you write query.value, but in the template you write query. Vue unwraps refs in templates. Forgetting .value in the script is the single most common beginner error, and the symptom is a filter that silently matches nothing.

Each of the three blocks has a job: script setup holds state and logic, template holds markup, and an optional style block holds CSS. The :key on v-for gives each item a stable identity so Vue updates the right element when the list changes.

04 · WHEN YOU NEED MORE

Router and Pinia, added one at a time

Add Vue Router when your app has more than one screen with its own URL, and Pinia when several components need the same shared state. Both have short official getting-started pages. Add them after your first small app works, not with the first scaffolding command, so you can see what each one fixes.

If you are still deciding whether Vue is the right framework, MDN has a framework-neutral introduction to client-side frameworks that explains the problems any of them solves.

05 · FREE RESOURCES

The official material, in order

06 · FAQ

Frequently asked questions

Do I need to know JavaScript before learning Vue?

Yes. Vue is built on JavaScript, so you should be comfortable with functions, arrays, objects, and modules first. Weak JavaScript is the main reason Vue code feels like magic instead of logic.

What do I need installed to start a Vue project?

Node.js. The Vue quick start lists version ^22.18.0 or >=24.12.0 as the requirement at the time of checking. Then run npm create vue@latest and follow the prompts.

Should I learn the Composition API or the Options API?

Start with the Composition API using script setup, which is what the official create-vue project generates. The Composition API FAQ in the Vue guide compares the two if you need to read older code.

Why is my ref not updating in the script?

Inside script you read and write a ref through its value property, for example query.value. Templates unwrap refs automatically, so there you use just the name. Forgetting value is the most common beginner error.

Is Vue free to use?

The official tutorial, guide and the quick start at vuejs.org are free to read, and create-vue scaffolds a project at no cost. Vue Router and Pinia have their own free documentation sites.

Keep going

Compare frameworks and round out your skills.