I have a question about how to use an event in one component to trigger an event in another. I have two components, both child components at the same level. If the updated() method is called in component1.vue, I want component2.vue method setValues() to fire.
This is what I have within created on component2.vue:
created() {
EventBus.$on('updatedComponent', () => {
this.setValues();
});
}
And this is within the updated() method in component1.vue:
EventBus.$emit('updatedComponent');
I have eventbus imported already in both components, and event bus does work (I tested with a console log within the $on) but it still does not work. Do I need to be placing my EventBus.$on in a different lifecycle hook?