Vue.js — The Progressive JavaScript Framework
Vue.js is a progressive framework for building user interfaces. It features an approachable core with an incrementally adoptable ecosystem — from simple script includes to full-featured SPA development with Composition API, reactivity, and single-file components.
What it is
Vue.js is a progressive JavaScript framework for building user interfaces. It provides a reactive data binding system, component architecture, and a rich ecosystem including Vue Router for navigation and Pinia for state management. Vue can be used as a lightweight library for enhancing static pages or as a full framework for single-page applications.
Vue targets frontend developers at all skill levels. Its gentle learning curve makes it accessible to beginners, while its Composition API and TypeScript support satisfy the needs of large-scale application development.
How it saves time or tokens
Vue's single-file component format (.vue files) co-locates template, script, and style in one file, reducing context switching during development. The Composition API enables logic reuse through composable functions, eliminating the need to restructure components when sharing behavior.
The Vue CLI and Vite-based scaffolding tool (create-vue) set up a production-ready project with routing, state management, and build optimization in a single command. This eliminates hours of boilerplate configuration.
How to use
- Create a new Vue project:
npm create vue@latest my-app
cd my-app
npm install
npm run dev
- Edit
src/App.vueto build your interface:
<script setup>
import { ref } from 'vue'
const count = ref(0)
</script>
<template>
<button @click="count++">Count: {{ count }}</button>
</template>
- Build for production:
npm run build
Example
<script setup lang="ts">
import { ref, computed } from 'vue'
interface Todo {
id: number
text: string
done: boolean
}
const todos = ref<Todo[]>([
{ id: 1, text: 'Learn Vue 3', done: false },
{ id: 2, text: 'Build an app', done: false }
])
const remaining = computed(() =>
todos.value.filter(t => !t.done).length
)
function toggle(todo: Todo) {
todo.done = !todo.done
}
</script>
<template>
<h2>Todos ({{ remaining }} remaining)</h2>
<ul>
<li v-for="todo in todos" :key="todo.id">
<input type="checkbox" :checked="todo.done" @change="toggle(todo)" />
{{ todo.text }}
</li>
</ul>
</template>
This demonstrates Vue's reactivity system, computed properties, list rendering, and TypeScript integration in a single-file component.
Related on TokRepo
- AI coding tools -- Explore tools that enhance frontend development workflows
- Featured workflows -- Discover other popular frameworks and libraries
Common pitfalls
- Mixing Options API and Composition API in the same project creates inconsistency. Pick one style and apply it consistently. The Composition API with
<script setup>is the recommended approach for new projects. - Vue's reactivity system tracks property access. Destructuring reactive objects loses reactivity. Use
toRefs()when destructuring props or store state. - Large Vue applications need code splitting. Without lazy-loaded routes (
defineAsyncComponentand dynamic imports), the initial bundle grows large and slows page load.
Frequently Asked Questions
Vue 3 introduced the Composition API, improved reactivity with Proxy-based tracking, better TypeScript support, Teleport and Suspense components, and significant performance improvements. Vue 2 reached end of life in December 2023. New projects should use Vue 3.
Vue uses single-file components with templates by default, while React uses JSX. Vue provides built-in reactivity, transitions, and a router as official packages. React's ecosystem relies more on third-party libraries. Vue has a gentler learning curve; React has a larger ecosystem and job market.
Yes. Nuxt is the official Vue framework for SSR. It provides file-based routing, auto-imports, SEO optimization, and hybrid rendering modes. For basic SSR without Nuxt, Vue provides the @vue/server-renderer package.
Yes. Vue 3 is written in TypeScript and provides first-class TypeScript support. The Composition API with <script setup lang='ts'> enables full type inference for props, events, slots, and composables. Volar is the recommended VS Code extension for Vue TypeScript support.
Pinia is the officially recommended state management library for Vue 3. It replaced Vuex as the default choice. Pinia provides a simpler API, better TypeScript support, and devtools integration. For simple applications, Vue's built-in reactivity with provide/inject may be sufficient.
Citations (3)
- Vue.js Official Site— Vue.js is a progressive framework for building user interfaces
- Vue.js GitHub— Composition API and single-file components
- Pinia Documentation— Pinia is the recommended state management library
Related on TokRepo
Discussion
Related Assets
Conda — Cross-Platform Package and Environment Manager
Install, update, and manage packages and isolated environments for Python, R, C/C++, and hundreds of other languages from a single tool.
Sphinx — Python Documentation Generator
Generate professional documentation from reStructuredText and Markdown with cross-references, API autodoc, and multiple output formats.
Neutralinojs — Lightweight Cross-Platform Desktop Apps
Build desktop applications with HTML, CSS, and JavaScript using a tiny native runtime instead of bundling Chromium.