我需要在我的句子之间添加中断标签,但是当我这样做时,我会得到 [object Object] 来代替换行符。有人可以告诉我如何解决这个问题吗?
const openingText = 'We\'re happy to hear your project is underway. '
+ <br /> + 'You can review this business to tell others about your experience.';
浏览器中的示例:
开发工具中的示例:
当我这样写时,我得到一个语法错误:
const openingText = (
<>
We're happy to hear your project is underway.
<br /><br />
You can review this business to tell others about your experience.
</>
);
当我在引号内添加 br 标签时,它只是认为它是常规文本:
const openingText = 'We\'re happy to hear your project is underway. <br /><br />' +
'You can review this business to tell others about your experience.';