Skip to content
Advertisement

React – n of my JSON.String disappears after getting put in div

In my NFTDetails component is a description that comes out of a JSON. There are nn in it. There is no new line when I use the value of the JSON in a div, but there are new lines in the Firefox console when I console.log() it.

How can I use the n to display new Lines in my div.

NFTDetails.jsx – Snippet

JavaScript

metadata.description(JSON)

JavaScript

Advertisement

Answer

use white-space: pre-line; to leave whitespaces as in description

https://developer.mozilla.org/en-US/docs/Web/CSS/white-space

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement