Reactjs convert html string to jsx

前端 未结 9 1472
夕颜
夕颜 2020-11-22 10:09

I\'m having trouble dealing with facebook\'s ReactJS. Whenever I do ajax and want to display an html data, ReactJS displays it as text. (See figure below)

9条回答
  •  广开言路
    2020-11-22 10:34

    For those still experimenting, npm install react-html-parser

    When I installed it it had 123628 weekly downloads.

    import ReactHtmlParser from 'react-html-parser'
    
    
    {ReactHtmlParser(htmlString)}

提交回复
热议问题