⚠️ Malware / Trojaner / VirenSafe Link spinnt: Defender stuft harmlose Google-Links als Malware ein(02.09.2026 um 18:26 Uhr)
🔧 AI Nachrichten ChatGPT fällt aus - OpenAI bestätigt Störung vor "Astra"-Start(03.09.2026 um 18:17 Uhr)
🔧 AI Nachrichten Tour mit KI geplant: Amateur-Bergsteiger müssen gerettet werden(04.09.2026 um 15:41 Uhr)
📰 IT Security NachrichtenVolkswagen-Umbau: VW-Spitze beschließt einstimmig Zukunftsplan(05.09.2026 um 09:16 Uhr)
📰 IT Security NachrichtenEU-Zollreform 2026: Weitere Gebühr für günstige Pakete beschlossen(05.09.2026 um 09:48 Uhr)
🕵️ SicherheitslückenWhatsApp-Schwachstelle: Zugriff auf Fotos bei gesperrtem Android-Handy(03.09.2026 um 09:18 Uhr)
⚠️ Malware / Trojaner / VirenSafe Link spinnt: Defender stuft harmlose Google-Links als Malware ein(02.09.2026 um 18:26 Uhr)
🔧 AI Nachrichten ChatGPT fällt aus - OpenAI bestätigt Störung vor "Astra"-Start(03.09.2026 um 18:17 Uhr)
🔧 AI Nachrichten Tour mit KI geplant: Amateur-Bergsteiger müssen gerettet werden(04.09.2026 um 15:41 Uhr)
📰 IT Security NachrichtenVolkswagen-Umbau: VW-Spitze beschließt einstimmig Zukunftsplan(05.09.2026 um 09:16 Uhr)
📰 IT Security NachrichtenEU-Zollreform 2026: Weitere Gebühr für günstige Pakete beschlossen(05.09.2026 um 09:48 Uhr)
🕵️ SicherheitslückenWhatsApp-Schwachstelle: Zugriff auf Fotos bei gesperrtem Android-Handy(03.09.2026 um 09:18 Uhr)

26 🕛 kürzlich 2 Min Lesezeit
0

Understanding Vue Composables

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




1. What is a Composable?



In Vue 3, a composable is a stateful function that encapsulate reusable reactive logic.



A composable typically:




  • Uses Vue reactivity (ref, reactive, computed, watch)


  • Manages state


  • Can be reused across components


  • Usually follows the naming convention useSomething()




Example:




CODE
// useCounter.js
import { ref } from 'vue'

export function useCounter() {
const count = ref(0)

function increment() {
count.value++
}

return { count, increment }
}









2. What is NOT a Composable?



If a function does not manage reactive state, then it is not a composable.



These should be utility functions



Example:




CODE
export function formatDate(date) {
return new Date(date).toLocaleDateString()
}






This function:




  • Has no reactive state


  • Is pure logic




So it shouldn't live in composables/






Mixins vs Store vs Composables (Vue)






1. Mixins



Mixins were mainly used in Vue 2 to reuse component logic.



They allow you to inject properties, methods, lifecycle hooks, and data into components.






Characteristics



Reuse logic between components



Automatically merges into component options






Problems with Mixins



Mixins have several issues:






⚠️Name collisions


If a component and mixin define the same method or property.






⚠️ Implicit dependencies


Hard to know where data or methods come from.



Because of these issues, Vue 3 recommends composables instead of mixins.






2. Composables



Composables are functions that encapsulate reusable reactive logic






Characteristics



✅ Explicit imports

✅ Reusable reactive logic

✅ No name collisions

✅ Clear data origin

✅ Better TypeScript support



Composables are the modern replacement for mixins.






3. Store



The store is used for global shared state across the entire application.



🌍 Global state management

🔁 Shared between many components

📦 Centralized data source



Simple Rule of Thumb

Use Composables ⚙️

→ When reusing reactive logic across components



Use Store 🗂

→ When state must be shared globally



Avoid Mixins ⚠️

→ Legacy pattern replaced by composables

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 51%
🟡 In Evaluierung 27%
🟢 Keine Auswirkung 17%
Spannende Innovation 5%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Safe Link spinnt: Defender stuft harmlose Google-Links als Malware ein
1 Quelle
Überlebenskampf per Prompt: Google-KI schickt MrBeast in die Wildnis
1 Quelle
ChatGPT fällt aus - OpenAI bestätigt Störung vor "Astra"-Start
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Understanding Vue Composables

Thematisch verwandte Begriffe: Understanding, Composables · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...