将NavLink与外部URL一起使用

sno*_*ler 4 reactjs react-router

我有以下代码:

    <NavLink to="//student.lvh.me:8080/users/edit">
      <DropDownLink>Wiki</DropDownLink>
    </NavLink>
Run Code Online (Sandbox Code Playgroud)

如何让navlink与外部URL一起使用?我在控制台中收到以下错误:

Uncaught DOMException: Failed to execute 'pushState' on 'History': A history state object with URL 'http://student.lvh.me:8080/users/edit' cannot be created in a document with origin 'http://localhost:3000' and URL 'http://localhost:3000/'.

有没有更好的方法来处理外部链接?

Sag*_*b.g 6

react-router 意味着在单页应用程序中"路由".当您想要路由到不在单个页面上路由的外部页面时.
只需使用普通的锚标签?react-router