传递一个被文本包围的 HTML 元素作为 props 参数

Pass an HTML element surrounded by text as a props argument

我正在使用 defaultProps

将所有参数传递给我的组件
MyComponent.defaultProps = {
    arg1: "hello"
    arg2: "word"
}

我可以像这样传递整个 link 标签

   arg3: <a id="link" href="https://github.com/myLink">View my portfolio on Github.</a>

我只希望 GitHub 这个词成为 hyperlink。所以这个论点看起来更像这样:

"View my portfolio on" <a id="link" href="https://github.com/myLink">Github.</a>

传递一个 HTML 元素,它封装了您想要显示的所有内容。

<span>View my portfolio on <a id="link" href="https://github.com/myLink">Github.</a></span>