Is there a way for navigating from one lightning web component to another via lightning/navigation
as I was possible in lightning?
And is there also an equivalente for component.destroy()
in lightning web component?
Is there a way for navigating from one lightning web component to another via lightning/navigation
as I was possible in lightning?
And is there also an equivalente for component.destroy()
in lightning web component?
Best Answer
You can navigate to one lightning web component from another lightning web component by creating a URL in Base64 encoded form. Use the below code in your method to navigate. Here the name of the lightning web component where I am navigating is one.
Another Approach(Documented way)
You can navigate to one lightning web component from another Lightning web component. You need to embed the Lightning web component inside an Aura Component and then use lightning navigation as below:-
To Navigate use below code in your method:-
Refer this question to know how you can retrieve the value in Aura component from Lightning web Component:- How to pass attribute when redirecting from lwc to aura component