Chapter 19: Vue Why, How and Setup
Why Vue? + How Vue Works? + How to Set It Up?” lesson, like the very first real class in a serious Vue 3 course in Hyderabad in 2026. No rushing, lots of real talk, analogies, examples, and the exact modern path most good developers follow right now.
Grab your notebook (or VS Code) — let’s go step by step.
1. Why Vue? (The Honest 2026 Answer)
Imagine you’re choosing a frontend framework in February 2026.
You basically have four serious contenders for new projects:
| Framework | Learning Curve | Bundle Size (min+gzip) | Performance (2026) | Developer Experience | Job Market (India 2026) | Ecosystem Maturity |
|---|---|---|---|---|---|---|
| React | Medium–High | ~45–70 KB | Very good | Good (but hooks magic) | Extremely high | Huge |
| Vue 3 | Low–Medium | ~20–35 KB | Excellent | Excellent (feels natural) | Very high (growing fast) | Very mature |
| Svelte / SvelteKit | Low | ~4–15 KB | Outstanding | Super clean | Growing fast | Good |
| Angular | High | ~65–100 KB | Good | Structured & strict | Stable but lower | Very mature |
Why many teams (especially in India, startups, mid-size companies) choose Vue in 2026:
- Extremely gentle learning curve → You write mostly normal HTML + CSS + JavaScript → No huge mental model shift like React hooks rules or Angular’s DI/decorators
- Fantastic developer experience right away → <script setup> = minimal boilerplate → Directives feel like super-powered HTML (v-if, v-for, v-model) → Reactivity just works (no useState + useEffect dance everywhere)
- Smaller & faster out of the box → Vue 3 core runtime ≈ 20 KB gzipped → Vite builds are tiny & lightning-fast HMR
- Progressive adoption → You can start with one <script> tag on an old PHP/WordPress page → Later go full SPA → later add SSR with Nuxt → later go islands / partial hydration
- Beautiful balance between structure & freedom → Enough structure (SFCs, router, Pinia) to keep large teams sane → Enough freedom so you don’t feel handcuffed
- Huge real-world usage in India & Asia Alibaba, Xiaomi, JD.com, Meituan, Bilibili, Tencent, Didi… all massive Vue shops → Lots of Indian startups & product companies choose it (cheaper to hire, faster delivery)
Short honest answer in 2026:
If you want to ship beautiful, fast, maintainable UIs quickly — and don’t want to fight the framework every day — Vue 3 is still one of the sweetest spots in frontend right now.
2. How Vue Works? (Core Mental Model – 5-Minute Explanation)
Vue is a declarative, reactivity-driven UI library.
You describe what the UI should look like based on state — Vue handles when & how to update the real DOM.
Five big ideas:
-
Reactivity When you change a ref or reactive object → Vue knows exactly which parts of the UI depend on it → only those parts re-render.
-
Single-File Components (.vue) One file = HTML-like template + JavaScript logic + scoped CSS
vue0123456789101112131415161718<template><h1>Hello {{ name }}</h1><button @click="name = 'Vue Lover'">Change</button></template><script setup>import { ref } from 'vue'const name = ref('World')</script><style scoped>h1 { color: navy; }</style> -
Template Syntax (HTML + Superpowers)
- {{ }} → text interpolation
- :attr or v-bind:attr → dynamic attributes
- @event or v-on:event → events
- v-if / v-show / v-for / v-model → control flow & forms
-
Composition API (modern heart – <script setup>)
JavaScript01234567891011const count = ref(0)const double = computed(() => count.value * 2)watch(count, (newV) => console.log('Count changed to', newV))function increment() { count.value++ } -
Virtual DOM + Compiler optimizations Vue compiles templates to highly efficient render functions → In 2026 Vue 3.6+ has Vapor Mode (optional no-virtual-DOM path → even faster)
Mental model summary:
You → write state + template that describes UI based on state Vue → watches state changes → surgically updates only necessary DOM parts
3. How to Set Up Vue in 2026 (Modern & Recommended Path)
There are still 3 main ways — but only one you should use for serious work.
Best Way (2026 Standard): Vite + Vue 3 + TypeScript
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# 1. Create project (takes ~10 seconds) npm create vite@latest my-vue-app -- --template vue-ts # 2. Go inside & install cd my-vue-app npm install # 3. Start dev server (instant!) npm run dev |
→ Opens http://localhost:5173 → Edit src/App.vue → changes appear instantly (Hot Module Replacement)
Folder structure you get (clean & modern):
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
src/ ├── assets/ ├── components/ ├── views/ # or pages/ — page-level components ├── router/ # if you add vue-router ├── stores/ # if you add pinia ├── App.vue ├── main.ts └── vite-env.d.ts |
Quick First File – Hello World with Counter
Replace src/App.vue:
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
<template> <div class="app"> <h1>Hello Vue 3 from Hyderabad! 🌶️</h1> <p>Count: {{ count }}</p> <button @click="count++">+1</button> <button @click="count = 0">Reset</button> <p v-if="count >= 5" class="celebration"> Wow! You're on fire! 🔥 </p> </div> </template> <script setup> import { ref } from 'vue' const count = ref(0) </script> <style scoped> .app { text-align: center; padding: 4rem; font-family: system-ui, sans-serif; } button { margin: 0.5rem; padding: 0.8rem 1.5rem; font-size: 1.1rem; cursor: pointer; } .celebration { color: #ef4444; font-weight: bold; font-size: 1.4rem; animation: bounce 0.5s infinite alternate; } @keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-10px); } } </style> |
→ Save → see it live
Next Steps After First Run (Scaling Path)
-
Add routing
Bash0123456npm install vue-router@4 -
Add state management
Bash0123456npm install pinia -
Add TypeScript strictness (already there with vue-ts template)
-
(Optional but common) → switch to Nuxt 3 later if you need SSR/SEO/static generation
Bash0123456npx nuxi@latest init my-nuxt-app
Final 2026 Quick-Start Checklist
- Use Vite + Vue 3 + TypeScript (–template vue-ts)
- Always <script setup>
- Use ref / reactive / computed / watch
- Organize early: components/, views/, composables/
- Add vue-router & pinia when > 5–7 pages
- Use Tailwind or UnoCSS for styling (most popular in India right now)
Any part you want to go deeper right now?
- Why <script setup> is better than old export default?
- First project ideas after this hello-world?
- How to add router + pinia step-by-step?
- Vue vs React feeling in 2026 from Indian dev perspective?
Just tell me — we’ll keep building your Vue journey together 🚀
Happy learning from Hyderabad! 💙
