T
TanStack10mo ago
other-emerald

Declarative Link Handling with Async Parameters

What’s the best practice for using the Link component when a parameter (e.g., sessionId) needs to be fetched via an async call? I know I can use router.navigate() imperatively, but is there a declarative way to handle this scenario?
<Link
from={Route.fullPath}
to={"./$sessionId/selectSystem"}
params={{ sessionId: someAsyncFunctionCall }} // <-- i want this to populate onClick.
>
Start New Session
</Link>
<Link
from={Route.fullPath}
to={"./$sessionId/selectSystem"}
params={{ sessionId: someAsyncFunctionCall }} // <-- i want this to populate onClick.
>
Start New Session
</Link>
Does the onClick event fire before the Link navgiates? If so, I could get the sessionId from the server, then have the link go. Thanks for your suggestions!
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?