Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Linux Tipps & HardeningSecurity: Ausführen beliebiger Kommandos in perl-Dancer2 (Fedora)(29.09.2026 um 07:43 Uhr)
•
Linux Tipps & HardeningSecurity: Denial of Service in perl-HTML-FormFu (Fedora)(29.09.2026 um 07:46 Uhr)
••
Linux Tipps & HardeningSecurity: Zwei Probleme in NetworkManager-l2tp (Fedora)(29.09.2026 um 07:46 Uhr)
••
Sicherheitslücken (CVE)CVE-2026-77144 | TYPO3 Events 2 Plugin up to 10.2.11 permission(29.09.2026 um 06:21 Uhr)
•
Sicherheitslücken (CVE)CVE-2026-21753 | HCL Hive 1.0 unmaintained third party components(29.09.2026 um 06:21 Uhr)
••
Sicherheitslücken (CVE)CVE-2026-75038 | ilya-zlobintsev LACT up to 0.10.0 symlink(29.09.2026 um 06:21 Uhr)
••
Linux Tipps & HardeningSecurity: Ausführen beliebiger Kommandos in perl-Dancer2 (Fedora)(29.09.2026 um 07:43 Uhr)
•
Linux Tipps & HardeningSecurity: Denial of Service in perl-HTML-FormFu (Fedora)(29.09.2026 um 07:46 Uhr)
••
Linux Tipps & HardeningSecurity: Zwei Probleme in NetworkManager-l2tp (Fedora)(29.09.2026 um 07:46 Uhr)
••
Sicherheitslücken (CVE)CVE-2026-77144 | TYPO3 Events 2 Plugin up to 10.2.11 permission(29.09.2026 um 06:21 Uhr)
•
Sicherheitslücken (CVE)CVE-2026-21753 | HCL Hive 1.0 unmaintained third party components(29.09.2026 um 06:21 Uhr)
••
Sicherheitslücken (CVE)CVE-2026-75038 | ilya-zlobintsev LACT up to 0.10.0 symlink(29.09.2026 um 06:21 Uhr)
••
Intelligence View
⚡ tsecurity.de Intelligence

What ref() and reactive() Are Actually For

Vue 3 gives you two ways to make something reactive: ref() and reactive(). The docs explain the difference clearly enough. What they don't tell you is which one to reach for by default. The short answer: ref(), almost always. reactive()…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Vue 3 gives you two ways to make something reactive: ref() and reactive(). The docs explain the difference clearly enough. What they don't tell you is which one to reach for by default.



The short answer: ref(), almost always. reactive() for specific situations where you know what you're trading away.



Here's the problem with reactive(). It loses reactivity when you destructure it or reassign the root object, which catches people off guard more than it should.




const state = reactive({ count: 0, name: '' });

state.count++; // works, Vue tracks this
const { count } = state;
count++; // doesn't work, Vue has no idea






ref() sidesteps this because the reactive pointer lives on the .value property. You can pass a ref anywhere, destructure the container, and the ref itself stays tracked.



The case where reactive() actually earns its place: a form object where all the values are always read and written together, passed as-is to a composable, and you're never going to replace the whole reference. Some people find dropping the .value noise worth that constraint. I get it. But in composables especially, ref() is much easier to work with because you can return individual refs that stay reactive when the caller destructures them.




export function useCounter() {
const count = ref(0);
const increment = () => count.value++;
return { count, increment };
}

const { count, increment } = useCounter(); // both still reactive






You can't do that cleanly with reactive() — destructuring breaks the connection.



For most of the time I was figuring out the ref/reactive split, I was making it more complicated than it needed to be. Default to ref(). Reach for reactive() when you have a specific reason. That's the whole decision.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten What ref() and reactive() Are Actually For

Thematisch verwandte Begriffe: What, reactive, Actually · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-102367 | mall4j through 4.0 contains an insufficient session expiration vulnerab…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag