如何在 JSON 字符串中将 \n 替换为 <br> ?

Yer*_*nov 2 javascript string reactjs

我从 JSON 文件中获取以下原始字符串。我 console.log 它显示正常。

"Hello, my name is Jane, from "IStaff" company.\r\n\r\n.We are interested in your service.\r\n\r\n.Please call me back "
Run Code Online (Sandbox Code Playgroud)

当我渲染这个字符串时,没有新行。

Yer*_*nov 7

就我而言,最好的方法就是添加 css :white-space: pre-wrap;