Vue tips · 132 tips

Vue & Nuxt tips

Over the last few years, I've collected a list of valuable tips while developing and writing about Vue & Nuxt. Some are clever, some I use almost every day, and some are more advanced — but they're all useful.

#79

Vue Tip: Debug Watcher

You can debug watchers by passing a third options object with onTrack and onTrigger callbacks.

1 minScript
#77

Vue Tip: Chaining Event Modifiers

By chaining multiple event modifiers together, you can create sophisticated event handling scenarios with ease.

1 minTemplate
#72

Nuxt Tip: Render Component Only on Client-Side

By default, Nuxt uses universal (client-side + server-side) rendering to render your application. The ClientOnly component can be used torender its slot only in client-side.

1 minNuxt
#71

Vue Tip: Validate Events and Prop Types

You can validate prop types and events in Vue. If a requirement is not met, Vue will warn you in the browser's JavaScript console.

1 minScript
#70

Nuxt Tip: Refresh Data by Watching Sources Using useAsyncData

Nuxt 3's useAsyncData() composable can be used within your pages, components, and plugins to get access to data that resolves asynchronously. It can also be used to refresh the data loaded from the API based on the user's action. (pagination, filtering results, searching, etc.)

1 minNuxt
#69

Vue Tip: When to Use Render Function

When should I use a render function in Vue.js? We’re going to cover some advanced Vue.js patterns when you need to use render functions.

1 minTemplate
#68

Nuxt Tip: Rendering Modes

Nuxt 3 provides plenty of options for rendering. There are SSG, SSR, Universal, SPA, ISG, or mix it up per route with hybrid rendering.

2 minNuxt
#61

Pinia Tip: Use Setup Stores for More Flexibility

Besides Option Stores you can also use Setup Stores to define stores in Pinia. They bring more flexibility as you can create watchers within a store and freely use any composable.

1 minPinia
Page 3 of 6