我是 JSX/React 的新手,如果有人问过这个问题,请先向我道歉,请让我参考这个问题。为了删除一些内联代码,我创建了一个函数,它返回要在模板/JSX 中显示的值,这工作正常,除非它需要返回一个字符串 + 一个元素(链接元素),该函数如下所示:
let displayText = () => {
let supportLink = <Link component={RouterLink} to={`/customers/${customer.id}/support`}>support</Link>
return `We are unable to do something. If you have further questions, please contact our ${supportLink}`
};
实际上这看起来像
We are unable to do something. If you have further questions, please contact our [object, object]
如何在我的字符串中包含该元素并使其正确显示?
侃侃无极
相关分类