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.
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.
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.
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.
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.
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, 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.
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, 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.
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, 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.
How to use Cypress for Vue E2E tests
End-to-end tests with Cypress verify complete user flows by running real browser interactions against your Vue application. As the creator of CoreUI, I’ve used Cypress to catch integration issues that unit tests miss, like broken API connections and routing bugs. The standard approach installs Cypress, writes specs using its chainable commands, and runs them against a local or staging server. This provides high confidence that users can actually complete their tasks.
How to snapshot test Vue components
Snapshot tests capture the rendered output of components and alert you when it changes unexpectedly.
As the creator of CoreUI, I’ve used snapshot testing to catch accidental regressions in UI components across hundreds of components.
The standard approach uses @vue/test-utils to mount components and Vitest’s toMatchSnapshot to compare renders against stored snapshots.
This provides an automatic safety net for your component’s output.