Scenario
In my current setup with Next.js 13, I am utilizing Apollo Client to manage some client side variables.
Objective
I aim to trigger the onClick function before navigating to the href location.
The Code I'm Using
<Link
href={`/session/${session.id}`}
onClick={() => {
updateDialogVars({
dialogOpen: ATTENDANCE_DIALOG,
})
}}
>
<div>
stuff
</div>
</Link>
The updateDialogVars method is a mutation that updates reactive vars in Apollo Client.
Inquiry
Is it feasible to leverage the Next.js Link component to execute the onClick event prior to routing to the href? Or should I convert the Link to a div and employ Next Router to push the route change after executing the onClick function?