语义 UI - 使用图标元素导航到外部 link

Semantic UI - navigating to external link using Icon element

我使用的是 reactsemantic-ui-react

的最新版本

我将此 Icon 元素设置为从语义实现导航到外部 link (github)

        <Menu.Item
          position="right"
          to="https://github.com"
          as={Link}
        >
          <Icon name="github" size="big" />
        </Menu.Item>

当我单击 UI 中的图标时,它试图将 github url 附加到 UI 的 url 中。所以我在 localhost:blah/someUrl 它请求 localhost:blah/someUrl/https://github.com

这是路由问题还是滥用 <Icon> 道具?

这是router link的误用:如果你想link到外部页面,请不要使用routers <Link>组件。

它将按以下方式工作:

<Menu.Item
 href="https://github.com"
 position="right"
 target="_blank"
>
 <Icon name="github" size="big" />
</Menu.Item>