Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

104
Views
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 \n\n 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

const NFTDetails = ({nfts}) => {
  const { id } = useParams();
  const navigate = useNavigate()

  const metadata = useMemo(
    () => nfts.find((nft) => String(nft.id) === id),
    [nfts, id]
  );

  return (
    <div className="NFTDetails">
        <div className="TextCard">
          <div className="NFTCName">{metadata.name}</div>
          <div className="Description">
            <p className='DescriptionText'>Description:</p>
            <p>{metadata.description}</p>
          </div>
       </div>

metadata.description(JSON)

{
   "description":"🧬 CLONE X 🧬\n\n20,000 next-gen Avatars, by RTFKT and Takashi Murakami 🌸\n\nIf you own a clone with even one Murakami trait please read the terms regarding third-party content here: https://rtfkt.com/legal-2B.\n\nYou are not entitled to a commercial license if you own an avatar with any traits created by Murakami."
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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

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

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!