How to use whiteSpace= ‘pre-wrap’ on React?

Posted by Pinki | Updated on

If you want to use whiteSpace= ‘pre-wrap’ on React JSX collapses whitespaces, in this case you can use dangerouslySetInnerHTML like so

For new versions of React/JSX, there is no need to use dangerouslySetInnerHTML.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers