Skill-
Forge
Learn
Notes
Language & Framework notes
CS Core Subjects
OS, DBMS, Networks, OOP & more
System Design
Architecture & High-Scale
Roadmaps
Guided developer learning paths
Cheat Sheets
Quick syntax references
Resources
Curated books, guides & links
Practice
Problems
DSA & coding challenges
Quizzes
Test your knowledge
Algorithms
Explanations & visualizations
Git Visualizer
Interactive Git graph & CLI playground
Aptitude
Placement & logic prep
Formula Simulators
Real-time quant equation simulators
Build
Projects Hub
Step-by-step real world projects
Resume Builder
ATS-friendly resumes, live preview & score
Tools
Online compilers & utilities
Skills
Core professional & tech skills
Error Encyclopedia
Search
⌘K
Install App
Start Learning
Menu
Learn
Notes
CS Core Subjects
System Design
Roadmaps
Cheat Sheets
Resources
Practice
Problems
Quizzes
Algorithms
Git Visualizer
Aptitude
Formula Simulators
Build
Projects Hub
Resume Builder
Tools
Skills
Error Encyclopedia
Search
Install Skill-Forge App
Appearance
Start Learning
Skip to main content
Cheatsheets
16 sections
46 cards
Vue 3.5 · Composition API · Pinia · 2025
💚
Vue 3 Cheat Sheet
Composition API · Reactivity · Directives · Router · Pinia · Lifecycle · Composables
Browse sections
Shortcuts
?
Hide Sidebar
Search cheatsheet sections
/
or
⌘K
Progress
0%
Table of contents
Shortcuts
?
⚡
Setup & Single-File Components
🔬
Reactivity API
🧩
Composition API — setup()
🎨
Template Syntax
🔀
Built-in Directives
📦
Components
📨
Props, Emits & v-model
🔄
Lifecycle Hooks
⚙️
Computed & Watch Patterns
🪝
Composables
🗺️
Vue Router 4
🍍
Pinia — State Management
🔗
Provide / Inject
⏳
Async Components & Suspense
✨
Transitions & Animations
📋
Quick Reference & Gotchas
J
K
Jump
/
Search
Esc
Clear
⚡
Setup & Single-File Components
Vite · SFC · Script Setup
Create Project (Vite)
Single-File Component (SFC) Structure
Project Structure
main.js — App Bootstrap
🔬
Reactivity API
ref · reactive · computed · watch
ref vs reactive — Full Comparison 🔥
ref vs reactive — When to Use
computed()
watch & watchEffect
🧩
Composition API — setup()
Script Setup vs Options API
script setup vs Options API 🔥
defineProps — Runtime vs TypeScript
defineEmits & defineExpose
Template Refs
🎨
Template Syntax
Interpolation · Binding · Events
Template Syntax Reference 🔥
Event Modifiers
🔀
Built-in Directives
v-if · v-for · v-model · v-show
All Directives 🔥
Custom Directives
v-if vs v-show
📦
Components
Slots · Dynamic · Async
Slots
Dynamic & Async Components
Teleport & Suspense
📨
Props, Emits & v-model
Component Communication
Component v-model (custom) 🔥
Fallthrough Attrs ($attrs)
🔄
Lifecycle Hooks
Component Lifecycle
Lifecycle Hooks Reference 🔥
Usage Examples
Options API ↔ Composition API
⚙️
Computed & Watch Patterns
Derived State & Side Effects
Computed Best Practices
Watch Patterns ⭐
🪝
Composables
Reusable Logic (useXxx)
Composable Patterns 🔥
Composable Rules ⭐
Name composables <b>useXxx()</b> by convention
Must be called inside <b>setup()</b> or <script setup> — not conditionally
Return reactive refs — not plain values
Always clean up in <b>onUnmounted</b> (timers, events, subscriptions)
Accept <b>refs or getters</b> as arguments (use <code>toValue()</code> inside)
Composables can call other composables
Can use lifecycle hooks — they register to the calling component
🗺️
Vue Router 4
Routing · Guards · Lazy Loading
Router Setup 🔥
useRouter & useRoute
RouterLink & RouterView
Navigation Guards
🍍
Pinia — State Management
Stores · Actions · Getters
Pinia Store — Setup vs Options 🔥
Using Stores in Components
Pinia Plugins
🔗
Provide / Inject
Dependency Injection
provide() & inject()
When to Use What
⏳
Async Components & Suspense
Loading States
Async setup() with Suspense
Error Boundaries (onErrorCaptured)
✨
Transitions & Animations
<Transition> · TransitionGroup
Transition Component
TransitionGroup (Lists)
📋
Quick Reference & Gotchas
Imports · Patterns · Pitfalls
Essential Imports Cheat Sheet 🔥
Vue 3 vs Vue 2 Key Differences
Vue 3 Gotchas ⭐
<b>Always use .value with refs</b> — forget .value in <script> and nothing updates (but not in template)
<b>reactive() destructuring breaks reactivity</b> — use <code>toRefs(state)</code> or switch to <code>ref()</code>
<b>Don't replace reactive() objects</b> — <code>state = { newProp: 1 }</code> breaks reactivity; use <code>Object.assign(state, {...})</code>
<b>watch is lazy by default</b> — add <code>{ immediate: true }</code> to run on mount
<b>v-for key must be unique and stable</b> — avoid index as key when list can reorder
<b>Computed must be pure</b> — no side effects (no mutations, no async inside computed)
<b>storeToRefs for Pinia state</b> — destructuring store directly loses reactivity for state
<b>defineProps/defineEmits are compiler macros</b> — no import needed in <script setup>
<b>onMounted = DOM is ready</b> — never access DOM refs before onMounted
<b>Async composables</b> — top-level await in <script setup> requires parent <Suspense>
<b>v-if has higher priority than v-for</b> — Vue 3 changed this from Vue 2 behavior
<b>nextTick()</b> — await nextTick() when you need to access DOM after a reactive change
Performance Tips ⭐
Use <code>v-show</code> for frequent toggles; <code>v-if</code> for conditional rendering of heavy components
<code>v-once</code> for truly static content — never re-renders
<code>v-memo</code> to skip subtree re-renders when deps unchanged (Vue 3.2+)
<code><KeepAlive></code> to cache components and avoid re-mounting
Use <code>shallowRef / shallowReactive</code> for large data structures that don't need deep reactivity
Lazy-load routes and heavy components with <code>defineAsyncComponent</code>
Use <code>markRaw()</code> for non-reactive objects (third-party class instances)
Avoid unnecessary <code>watch(obj, fn, { deep: true })</code> — use targeted property watches
Avoid creating new objects/arrays in computed getters — causes unnecessary re-renders