In this video we will learn together, How to make child or included component to do something when parent component does an action.
For this purpose we will use Event Bus.
Firstly create a new file in resources/js and name it event-bus.js
Import this file in both of your components
Let's say When you perform an action in parent component you want child component to do something As an example of shopping cart
Consider two components
1) Product Component (parent)
2) Cartcount Component (child)
When you add Product in cart you want the cart count component to increase number of products
So, When we have done action we will trigger the event by
Event Bus .$emit('event name' , 'anything if you want to send to it' )
and in child component
Event Bus .$on('event name' , check=(angle bracket sign which is greater than sign cannot write due to youtube policies){
//do some action
})