Using marked in react

前端 未结 4 1828
感动是毒
感动是毒 2020-12-25 14:50

I want to use marked in reactjs as described in the reactjs docs.

{marked(mystring)}

I use babel so I import marked

4条回答
  •  一整个雨季
    2020-12-25 15:46

    Here's an example on how to use marked with react:

    1. Install marked with NPM : npm i marked

    2. import it in your react app (this example is created with create-react-app), and using it example of a react component using "marked"

    3. result in the browser : preview

提交回复
热议问题