Really wonering - what is the advantage of using v-model compared to prop & emit pattern? Thanks for the amazing video but im still quite confused with the above
They are pretty much the same from my understanding, just in a more terse syntax. Like the video explains, v-model is just a shorthand for a prop and emit handler which just updates the value. One implication from a code structure standpoint is if you need to run other code as well as updating the state on each emit, you now need a watcher to do that. Before you could just inline the code inside the handler function. This theoretically COULD matter if the order of execution matters.
You could also place the @input on the component in the parent, and not having to emit from the child
the visualization is so good, ty
i love your video
thank you
Careful with mutating the parent props!
Really wonering - what is the advantage of using v-model compared to prop & emit pattern?
Thanks for the amazing video but im still quite confused with the above
They are pretty much the same from my understanding, just in a more terse syntax. Like the video explains, v-model is just a shorthand for a prop and emit handler which just updates the value.
One implication from a code structure standpoint is if you need to run other code as well as updating the state on each emit, you now need a watcher to do that. Before you could just inline the code inside the handler function. This theoretically COULD matter if the order of execution matters.