React Link 无法打开 heroku url
React Link cant open heroku url
我正在尝试在我的 React 项目中创建一个 Link 来打开另一个使用 Heroku 部署的项目,但是当我点击 link 时,页面的 url 变成了http://localhost:3000/mytrellos.herokuapp.com 而不是 https://mytrellos.herokuapp.com/ 所以页面无法渲染。谁能告诉我问题是什么?
这是我的代码:
<Link to="mytrellos.herokuapp.com/" target="_blank">
Visit Website
</Link>
```
因此您也需要添加 link 的协议,否则它会将 link url 附加到当前的 windows url。
所以 <a href="mytrellos.herokuapp.com/"></a>
转到 http://localhost:3000/mytrellos.herokuapp.com
您可以为此使用普通锚标记,因为这样做的目的只是在新标签页中打开 link
<a href="https://mytrellos.herokuapp.com/" target="_blank">
Visit Website
</a>
这应该有效
我正在尝试在我的 React 项目中创建一个 Link 来打开另一个使用 Heroku 部署的项目,但是当我点击 link 时,页面的 url 变成了http://localhost:3000/mytrellos.herokuapp.com 而不是 https://mytrellos.herokuapp.com/ 所以页面无法渲染。谁能告诉我问题是什么? 这是我的代码:
<Link to="mytrellos.herokuapp.com/" target="_blank">
Visit Website
</Link>
```
因此您也需要添加 link 的协议,否则它会将 link url 附加到当前的 windows url。
所以 <a href="mytrellos.herokuapp.com/"></a>
转到 http://localhost:3000/mytrellos.herokuapp.com
您可以为此使用普通锚标记,因为这样做的目的只是在新标签页中打开 link
<a href="https://mytrellos.herokuapp.com/" target="_blank">
Visit Website
</a>
这应该有效