Refer to the code below:
<item
itemName={"laptop"}
itemDescription={"- XXXX \n - PPPP"} // how could I make a new line for this?
/>
\n is not working at this
Refer to the code below:
<item
itemName={"laptop"}
itemDescription={"- XXXX \n - PPPP"} // how could I make a new line for this?
/>
\n is not working at this
You can do something like this:
{text.split(ā\nā).map(function(item) {
return (
{item}
<br/>
)
})}
In your particular case it would look like this:
itemDescription={<>XXXX <br /> - PPPP</>}
If your component takes nodes in that property, and not a string.
React doesn't use strings to create the HTMl, and HTML ignores line breaks, so you need to turn that string into JSX with line breaks, or paragraphs.