Issue
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
Solution
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
Answered By - Al Duncanson
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.