Skip to content
_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN DE
Let's talk

Vue 3 Composition API

23. 10. 2019 Updated: 27. 03. 2026 1 min read intermediate
This article was published in 2019. Some information may be outdated.

The Composition API is the recommended way to write Vue 3 components. Better TypeScript support, reusable logic, simpler large components.

Script Setup

{{ count }} ({{ doubled }})

Composables

// composables/useFetch.ts export function useFetch(url: string) { const data = ref(null); const error = ref(null); const loading = ref(true); fetch(url) .then(r => r.json()) .then(v => data.value = v) .catch(e => error.value = e) .finally(() => loading.value = false); return { data, error, loading }; } // Usage in a component const { data: users, loading } = useFetch(‘/api/users’);

Key Takeaway