Reactivity Loss On Destructuring (ARCH3321)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key typescript.vue.reactivity-loss · Severity error · Category quality
Vue: flags destructuring of props / reactive() / a store, which copies values out of the reactive object so they never update again. toRefs / storeToRefs keep the link.
Incorrect
Section titled “Incorrect”<script setup lang="ts">const props = defineProps<{ user: User }>();const { user } = props;</script>Correct
Section titled “Correct”<script setup lang="ts">const props = defineProps<{ user: User }>();const { user } = toRefs(props);</script>