Why does the TreeVIew example on vuejs have a child component modify data passed in via a prop? #9481
Unanswered
aryeh
asked this question in
Help/Questions
Replies: 1 comment
-
It usually is an anti-pattern, sure. Something usually being an antipattern doesn't mean you can't ever do it, or else...!!! The TreeItem is a recursive component that render itself as its nested children. All of the interaction between the nested TreeItems is encapsulated in TreeItem.vue. So yes, you could go the extra mile and use events to be super-clean, but as this is not really an interaction between multiple different components, but rather one component interacting with itself, you can just mutate the data in place, it's simpler that way. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a reason why the Tree View example on the vuejs website https://vuejs.org/examples/#tree modifies data that was passed in as a property to the child, rather than using events or v-model?
As I understand it, this is an anti-pattern. Am I missing something?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions