Everyone know this error: Each child in a list should have a unique "key" prop
But what if I have array of strings that I want to render in my paragraph with
at the end?
return(
<p>
{array.map(string => {
return <>{string}<br/></>
})}
</p>
)
As you can see I'm literally returning only text with <br/>
at the end, I don't have place or need for a key. How can I get rid of this error? Wrapping every phrase in <span>
is not an option.
` here? Depending on what you're doing, maybe drop the `p` and use a `ul` or `li` which is the correct semantic for lists of items. See [this](https://stackoverflow.com/questions/1726073/is-it-sometimes-bad-to-use-br#:~:text=The%20main%20reason%20for%20not,space%20the%20blocks%20out%20properly.) – ggorlen Dec 03 '20 at 22:39
`. I don't want react to listen to it, since I'm literally printing several lines into same paragraph. – Alyona Dec 04 '20 at 07:55