Passing data between Lit Element templates when using router

598 Views Asked by At

I am new to Lit Element, let's say I have two lit templates : <page-one> and <page-two> and I'm using Vaadin Router to navigate between them.

I have initialized the Routes as :

router.setRoutes([
{
path: "/",
component: "page-one",
},
{
path: "/page-two",
component: "page-two",
action: async () => {
    await import(
        "../src/components/page-two"
    );
  }
])

And I have added a button click to navigate to the other template using Router.go("page-two") , which is working fine.

Since I am not using the second template inside a Render(), how do I pass on data from <page-one> to <page-two> ?

Note : If I had it in the Render() method, I could have passed it as a @property , like : <page-two @value="data"> </page-two>. But that is not the case here.

0

There are 0 best solutions below