I am using react and trying to have an anchor tag that links to an external website " https://www.google.com/ ".
I have two instances of this anchor tag in my code.
The first tag is working as expected, the external link is visited without any problem.
However, if I am in the root "localhost:3000" and I click on the second tag, it appends the URL to the current URL "localhost:3000/ https://www.google.com/ " .
If I navigate to another page in my app "localhost:3000/example" and then click on the tag it will go the external link without any problems.
I have tried trimming the start of the URL to get rid of any unwanted "/" but it does not work.
This is the code I am using
<a href={newAddress}>{contactUsButton}</a>);
You can use this
import { Redirect } from 'react-router'
<Redirect to="/your url" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.