Navigation from one LWC component to another LWC Component
How to navigate from one LWC Component to another LWC Component. Let's look at it.
It's such a bummer that we cannot navigate from one Lightning Web component to another Lightning Web Component.
However, there is a workaround, if you want to navigate the user from one LWC to another LWC, you can embed LWC in an Aura Component and navigate the user from LWC to an Aura Component.
Out of the box, LWC framework provides us helper methods to send the user from Lightning Web Component to an Aura Component.
In fact, there are a whole bunch of destinations to which we can navigate the user from a Lightning Web Component.
Let's look at the snippet to send a user from LWC to Aura Component (that has another LWC embedded in it).
This is the controller file of the Web Component.
This is how the configuration object is going to look like and pretty much all the info that we need to provide related to the navigation will be provided to this.
Just a heads up make sure you include the namespace before the key in the object that you provide for the key state.
This is the Aura Component in to which you need to embed the Lightning Web Component.
Hope this was helpful!