'Need help for textarea content

I am trying to display text from my database. The <p> doesn't show the expected newlines but <textarea> does.

I want to use it like this <p>{course.overview}</p>.

When I use this one <textarea type="text" placeholder={course.overview} className="form-control color-black overflow:scroll" name="overview" rows="95" disabled/> it keeps the format.

It's not exactly what I want but it's better than <p>{course.overview}</p>. What can I do?

I tried to use same className in <textarea type="text" placeholder={course.overview} className="form-control color-black overflow:scroll" name="overview" rows="95" disabled/>

with

<p className="form-control color-black overflow:scroll" >{course.overview}</p> but it changes nothing.

Pictures for example textarea= https://ibb.co/zSmmHrT AND p = https://ibb.co/1L07Dfk

Thanks in advance ! :)



Solution 1:[1]

Instead of using the <p> tag you could use the <pre> tag if it's plain text. Otherwise you would need to convert all your newlines with <br>

More about the issue here: https://www.w3schools.com/html/html_paragraphs.asp

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1