我是 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]如何在我的字符串中包含該元素并使其正確顯示?
從函數返回帶有 html 的字符串以在 JSX 中使用
qq_笑_17
2023-05-11 15:57:27