Reactjs dangerouslySetInnerHtml Alternatives

后端 未结 1 361
执念已碎
执念已碎 2021-01-27 06:24

So I\'m currently building a blogpost and the entire \'post\' of this JSON file contains HTML in it, things like

or
and
1条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-27 06:58

    You can use DOMPurify to sanitize your HTML before inserting it in the DOM via dangerouslySetInnerHTML. Hope it works!

    0 讨论(0)
提交回复
热议问题