Next.js starter your AI actually understands. Ship internal tools in days not weeks. Pre-order $199 $499 → [Get it now]

How to use watchEffect() in Vue 3

watchEffect() automatically tracks all reactive dependencies used inside it and re-runs whenever any of them change — without you having to specify which values to watch. As the creator of CoreUI with Vue development experience since 2014, I use watchEffect() when a side effect depends on several reactive values and I don’t want to manually maintain a list of dependencies. The key difference from watch() is that watchEffect runs immediately on first call and doesn’t provide old values — it’s ideal for synchronization effects rather than reactive comparisons. Understanding when to choose watchEffect vs watch makes your Vue code cleaner and more maintainable.

Read More…

How to use watch() in Vue 3

watch() in Vue 3 runs a side effect in response to reactive state changes — fetching data when a filter changes, saving state to localStorage, or triggering animations when a value updates. As the creator of CoreUI with Vue development experience since 2014, I use watch() whenever I need to react to a change with a side effect, and computed() when I just need a derived value. The key difference from watchEffect() is that watch() is explicit — you declare exactly what to watch and receive the old and new values in the callback. This makes it easier to understand what triggers the watcher and to compare values before and after.

Read More…

How to use computed() in Vue 3

computed() creates a cached reactive value derived from other reactive state — it recalculates only when its dependencies change, making it more efficient than calling a method in the template on every render. As the creator of CoreUI with Vue development experience since 2014, I use computed() extensively in CoreUI Vue components for filtering, sorting, and formatting data that depends on reactive state. The most important distinction from a regular method is caching — if the dependencies haven’t changed, Vue returns the cached result instantly without re-running the function. This makes computed the right choice for any derived value accessed in a template.

Read More…

How to use ref() in Vue 3

ref() is the foundational reactivity primitive in Vue 3’s Composition API, wrapping any value — string, number, boolean, object, or array — in a reactive container that Vue can track. As the creator of CoreUI with Vue development experience since 2014, I use ref() as the default choice for reactive state in every Vue 3 component because it works consistently with all value types. The one thing to remember is that ref values must be accessed with .value in JavaScript, while Vue templates automatically unwrap refs so you write {{ count }} not {{ count.value }}. This distinction catches new Vue 3 developers by surprise but becomes second nature quickly.

Read More…

How to use reactive() in Vue 3

reactive() creates a deeply reactive proxy of a plain object, making Vue track all nested property changes automatically — unlike ref() which wraps a single value. As the creator of CoreUI with Vue development experience since 2014, I use reactive() when managing objects with multiple related properties that should be kept together, such as form state or a user profile. The key difference from ref() is that reactive() returns the object directly — no .value wrapper — making it feel more natural for complex objects. Understanding when to use reactive() vs ref() is one of the most important decisions in Vue 3 Composition API code.

Read More…

How to use setup() in Vue 3

The setup() function is the entry point for the Composition API in Vue 3, replacing the scattered data, computed, methods, and lifecycle options of the Options API with a single, cohesive function. As the creator of CoreUI with Vue development experience since 2014, I’ve migrated dozens of complex components from Options API to setup() and the result is consistently more readable and testable code. Everything you return from setup() becomes available in the template — reactive references, computed properties, and methods alike. Understanding setup() is the foundation for all other Composition API features.

Read More…

How to use defineComponent in Vue 3

defineComponent is a Vue 3 utility function that enables full TypeScript support by providing proper type inference for component options and the setup function. As the creator of CoreUI with Vue development experience since 2014, I use defineComponent in every TypeScript Vue component because it makes IDEs correctly infer prop types, emitted events, and the return value of setup. Without it, TypeScript treats the component object as a plain object and loses the Vue-specific type information. For <script setup> components you don’t need it — it’s most valuable when writing components with explicit setup functions or Options API in TypeScript files.

Read More…

How to configure lint-staged in Vue

Running the linter on your entire codebase before every commit is slow and discourages developers from committing often. As the creator of CoreUI with 25 years of experience building large-scale frontend projects, I’ve standardized on lint-staged to run ESLint and Prettier only on the files you actually changed. Combined with Husky git hooks, this setup catches code quality issues automatically without slowing down your workflow. The result is a consistent codebase where every committed file meets your style and quality standards.

Read More…

How to migrate Vue 2 to Vue 3

Migrating from Vue 2 to Vue 3 requires addressing breaking changes in the API, removed features, and updated behavior. As the creator of CoreUI with over 10 years of Vue.js experience since 2014, I’ve led Vue 2 to Vue 3 migrations for large applications and open-source libraries. The most effective approach uses the official migration build to run Vue 3 with Vue 2 compatibility flags, then addresses warnings one by one. This incremental strategy avoids a big-bang rewrite.

Read More…

How to migrate Options API to Composition API in Vue

Migrating from Options API to Composition API improves code organization, TypeScript support, and logic reusability across components. As the creator of CoreUI with over 10 years of Vue.js experience since 2014, I’ve led migrations for large Vue 2 codebases to the Composition API. The key is mapping each Options API section - data, computed, methods, watch, and lifecycle hooks - to their Composition API equivalents. The logic becomes more collocated and easier to extract into reusable composables.

Read More…