DEV Community

Discussion on: Sharing Data Between Components in Vue.js

Collapse
 
dysiode profile image
Patrick Kennedy

This approach to watching the property is very unique. Is there a usecase where it would be preferable to storing the message list in the parent or emitting events from the parent and listening in the child?

Collapse
 
alexmourer profile image
Alex Mourer

Hey Patrick, you are correct. The watch property section in the example is somewhat unique. I wanted this component to be able to accept a string from any source and then create an array from that inside the component.

I would be interested in seeing an example of what you are suggesting. If you have time, feel free to fork the codesandbox example.