# Tính reactive của Vue (Vue.js / Nuxt.js) > Reactivity system, reactive vs ref, toRef, toRefs, unref, shallow reactivity, readonly - 20 câu hỏi phỏng vấn - Mid-Level - [Câu hỏi phỏng vấn: Vue.js / Nuxt.js](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van.md) ## 1. Hệ thống reactive của Vue là gì? **Câu trả lời** Hệ thống reactive của Vue tự động phát hiện các thay đổi trong dữ liệu và cập nhật DOM tương ứng. Nó dựa trên các Proxy của JavaScript để chặn việc truy cập và sửa đổi thuộc tính. Hệ thống này đảm bảo giao diện người dùng luôn được đồng bộ với trạng thái ứng dụng mà không cần can thiệp thủ công. ## 2. Sự khác biệt chính giữa ref() và reactive() là gì? **Câu trả lời** ref() tạo một tham chiếu reactive cho một giá trị primitive hoặc object, được truy cập qua .value, trong khi reactive() tạo một proxy reactive của một object mà không cần .value để truy cập các thuộc tính. ref() có tính phổ quát (primitive + object) và lý tưởng cho các giá trị đơn giản, còn reactive() được tối ưu cho object nhưng không hoạt động với primitive. Trong thực tế, ref() thường được ưa chuộng hơn vì nó hoạt động với mọi kiểu dữ liệu. ## 3. Làm thế nào để truy cập giá trị của một ref trong template so với trong script? **Câu trả lời** Trong template, Vue tự động unwrap các ref, cho phép truy cập trực tiếp mà không cần .value (ví dụ: {{ count }}). Trong script, bạn phải dùng .value để đọc hoặc sửa giá trị của ref (ví dụ: count.value++). Hành vi tự động này trong template giúp đơn giản hóa việc viết code trong khi vẫn duy trì sự kiểm soát rõ ràng trong logic JavaScript. ## Còn 17 câu hỏi nữa - Điều gì xảy ra nếu bạn destructure một object reactive()? - toRefs() trong Vue dùng để làm gì? Đăng ký miễn phí: https://sharpskill.dev/vi/login ## Các chủ đề phỏng vấn Vue.js / Nuxt.js khác - [Kiến thức nền tảng JavaScript](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/javascript-fundamentals.md): 20 câu hỏi, Junior - [JavaScript hiện đại (ES6+)](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/es6-modern-javascript.md): 20 câu hỏi, Junior - [Kiến thức cơ bản về Vue](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/vue-basics.md): 22 câu hỏi, Junior - [Component Vue](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/vue-components.md): 20 câu hỏi, Junior - [Vue Router](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/vue-router.md): 18 câu hỏi, Junior - [Pinia State Management](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/pinia-state-management.md): 20 câu hỏi, Junior - [Vuex (Legacy)](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/vuex-legacy.md): 15 câu hỏi, Mid-Level - [Composition API](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/composition-api.md): 24 câu hỏi, Mid-Level - [Kiến thức cơ bản về Nuxt](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/nuxt-fundamentals.md): 22 câu hỏi, Mid-Level - [Data Fetching trong Nuxt](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/nuxt-data-fetching.md): 20 câu hỏi, Mid-Level - [SSR & SSG trong Nuxt](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/nuxt-ssr-ssg.md): 22 câu hỏi, Mid-Level - [Server Routes Nuxt](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/nuxt-server-routes.md): 20 câu hỏi, Mid-Level - [Module Nuxt](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/nuxt-modules.md): 18 câu hỏi, Mid-Level - [Composables trong Vue](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/vue-composables.md): 20 câu hỏi, Mid-Level - [Form & Validation Vue](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/vue-forms-validation.md): 20 câu hỏi, Mid-Level - [Quản lý trạng thái Nuxt](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/nuxt-state-management.md): 18 câu hỏi, Mid-Level - [Testing trong Vue](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/vue-testing.md): 20 câu hỏi, Mid-Level - [Triển khai Nuxt & CI/CD](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/nuxt-deployment-cicd.md): 22 câu hỏi, Mid-Level - [Hiệu năng Vue](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/vue-performance.md): 22 câu hỏi, Senior - [Các mẫu nâng cao trong Vue](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/vue-advanced-patterns.md): 24 câu hỏi, Senior - [TypeScript với Vue](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/typescript-vue.md): 22 câu hỏi, Senior - [Xác thực Nuxt](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/nuxt-auth.md): 20 câu hỏi, Senior - [SEO với Nuxt](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/nuxt-seo.md): 20 câu hỏi, Senior - [Quốc tế hóa trong Nuxt](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/nuxt-i18n.md): 18 câu hỏi, Senior - [Kiến trúc Vue](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/vue-architecture.md): 22 câu hỏi, Senior - [Bảo mật Nuxt](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/nuxt-security.md): 20 câu hỏi, Senior - [Hệ sinh thái Vue](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/vue-ecosystem.md): 18 câu hỏi, Senior - [Di chuyển Vue 2→3 & Nuxt 2→3](https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/migration-vue2-vue3-nuxt2-nuxt3.md): 22 câu hỏi, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/vi/technologies/vue-nuxt/cau-hoi-phong-van/vue-reactivity