Events 18 / 42
We use props to pass data down, and events to pass data back up. Such custom events work the same as normal JavaScript events like click
.
This example keeps the state in the parent component and passes it to both VCounter components. We listen to a custom event update:count
, which updates the state count
.
In VCounter.vue
we emit this custom event using Vue's $emit
method.
Try adding a decrement button in VCounter.vue
.