Why does rich texts on strapi keeps markups visible in my app
Asked Answered
H

1

0

I have some problems with the strapi rich text editor. When I type some text, the format doesn't appear at all in the render of my app. No line break. Plus, the markDown code stays visible.

I tried by replacing the strapi text editor by react-quill and I still have the same problem. I type some text in the admin panel and when I render my app, all the html is visible.

What did I miss?

screen shot of the app

Hendon answered 14/9, 2021 at 15:42 Comment(0)
S
1

This is probably because you have to "say" to React that the content is HTML.

Could you try using the dangerouslySetInnerHTML prop?

Another solution would be to use react-markdown, as explained in this tutorial.

Sharrisharron answered 15/9, 2021 at 9:17 Comment(2)
Ok. It wasn't specified in the tuto, but I need to import react-quill or react-markdown in each page of the frontend where I use some rich text?Hendon
that makes sens. Thank you, I missed that part of the tutorialHendon

© 2022 - 2024 — McMap. All rights reserved.