Get props in async route

Hi. I am trying to migrate my app from v5 to v6 and I’ve got some problem with routing.

In v5 I use async this way:

{
	path: "...",
	async(routeTo, routeFrom, resolve){
		...
		const componentProps = routeTo.context; //return props
		return resolve({ component: MyPage }, { props: { ...componentProps } });
	}
}

So I was able to extract props from routeTo.

But in v6 there is no routeTo.context.

{
	path: "...",
	async({to, from, resolve}){
		...
		const componentProps = to.context; //return undefined
		return resolve({ component: MyPage }, { props: { ...componentProps } });
	}
}

How can I get props in async in v6? Or there should be another way to do it?

I able to get props by access params property

to.params

I think to.params only hold information about route link (for /#!/planet/11111/city/2222 to.params will be {planet: 11111, city: 2222}).
But I am using navigation to component with sending props to it like this:

toPlanet(planetInfo: any) {
        this.navigate(`/planet/`, {
            props: {
                planetName: planetInfo.name,
                planetSize: planetInfo.size,
                planetType: planetInfo.type
            }
        });
    }

And I cant undestand how I can get those props in async route (in v5 it was in context but in v6 it is removed)

I am sorry I forgot to mention, that I am using Framework7 with React.
My question is about this documentation - Navigation Router | Framework7 React Documentation and combining it with async (Navigation Router | Framework7 React Documentation)

you can’t
here is what you can do => gallant-yalow-hxldqk - CodeSandbox

1 Like

I did kinda the same thing as you show in sandbox and it works.
Thank you very much! It helped me a lot with my project.