I'm using react-router which means i'm storing routes in app.tsx
file.
I have cards components that need to redirect to an external url onClick
.
So my question is how to redirect onClick
on card component using the external url example: www.test.com and give to that url two query strings a=xxx
and b=xxx
You can redirect to an external URL with dynamic query strings with template literals:
const onClick = () => {
location.href = `www.test.com/?a=${queryA}&b=${queryB}`
}
where queryA
and queryB
are your dynamic injected query strings