FrontendVue· Tuspa Engineering· 2026-05-26
Composables over mixins
The Composition API replaces mixins with plain functions that own their state. A well-designed composable:
- Has a single responsibility
- Returns refs (or a
reactiveobject) plus actions - Never touches the DOM outside lifecycle hooks
The unwrapping pitfall
Refs only auto-unwrap in templates when they are top-level bindings. Nesting them in a plain object silently breaks template rendering — wrap composable returns in reactive() when consumers keep the object.