Mutating props when it's an array and is assigned to a REF. #7163
Replies: 1 comment
-
vue's responsive is reflected in the data update triggering the view update, vue3's responsive is achieved through |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm a bit confusing with this behaviour, so decided to ask for some help.
The scenario is: We have two components parent and child.
Normally if you try to mutate the
prop
you get an warning fromVue
to avoid props mutation.But what happens when you assign a
prop
to a localref
and than mutate theref
and that will also mutate theprop
Parent component
Child component
So pretty much this will mutate the
prop
without any warning and this is probably a anti-pattern ?Has todo with how the reactivity works behind the scenes.
Beta Was this translation helpful? Give feedback.
All reactions