reactjs 如何在API调用中从响应中呈现标记?

toiithl6  于 2022-11-29  发布在  React
关注(0)|答案(1)|浏览(145)

我在从响应中呈现标记而不是将其显示为文本(而不是HTML)时遇到了问题
ternet currency making mobile payment easy, very low transaction fees, protects your identity, and it works anywhere all the time with no central authority and banks. Bitcoin is designed to have only 21 million BTC ever created, thus making it a deflationary currency. Bitcoin uses the <a href="https://www.coingecko.com/en?hashing_algorithm=SHA-256">SHA-256</a> hashing algorithm with an average transaction confirmation time of 10 minutes. Miners today are mining Bitcoin using ASIC chip dedicated to only mining Bitcoin, and the hash rate has shot up to peta hashes. Being the first successful online cryptography currency, Bitcoin has inspired other alternative currencies such as <a href="https://www.coingecko.com/en/coins/litecoin">Litecoin</a>, <a href="https://www.coingecko.com/en/coins/peercoin">Peercoin</a>, <a href="https://www.coingecko.com/en/coins/primecoin">Primecoin</a>
这是来自API响应的代码片段

omtl5h9j

omtl5h9j1#

我目前使用的是html-react-parser。一旦安装并导入到你的应用程序中,就像在jsx中插入“parse(myDataVariable)”一样简单。查看文档。这是一个非常简单的设置。
https://www.npmjs.com/package/html-react-parser

相关问题