Vue tips
3 tips · newest first
Atomic Vue 3 tips covering the Composition API, reactivity gotchas, SSR safety, and the newest 3.5 APIs — each one a snippet you can apply in minutes.
Replace modelValue/update boilerplate with defineModel() for v-model
VUEdefineModel() returns a writable ref wired to the parent's v-model, collapsing the modelValue prop plus update:modelVal…
v-modelcomponents
@hnoozCancel stale async work in watchers with onWatcherCleanup()
VUERegistered inside the watcher callback, onWatcherCleanup runs before the next invocation and on stop. It removes the ma…
watchersasync
@hnoozGenerate hydration-safe unique IDs with useId() for accessibility
VUEuseId() produces IDs that are stable and identical across server render and client hydration, so label/for and aria-des…
ssraccessibility
@hnooz