In the previous post, we looked at how to use LMS in LWC to send data. In this post, we will look at how to send data from one Aura Component to another Aura Component using LMS.
We can do it using Application Events too. However, with LMS the implementation is a lot easier and it can be used with Aura and Visualforce too.
We need to create a message channel and we will not be looking at creating the messsge channel as we have seen in it in this post.
Let us look at the code snippet!
This is the Aura Component that will be publishing the data using LMS.
This is the controller of the publishing Aura Component.
Here is the Aura Component that subscribes to the message channel and receives data using LMS.
This is the controller file of the subscribing Aura Component.
Hope this is helpful!