DEV Community

Discussion on: Make line breaks work when you render text in a React or Vue component

Collapse
 
iainsimmons profile image
Iain Simmons

Or you make an array by splitting the strings and then insert the br tags wherever you need.

I'd do it with flatMap:
https://codesandbox.io/s/young-bash-4vevii?from-embed=&file=/src/App.js