How can I insert a line break into a component in React Native?

Answer

React won't like you putting HTML <br /> in where it's expecting text, and ns aren't always rendered unless in a <pre> tag.

Perhaps wrap each line-breaked string (paragraph) in a <p> tag like this:

{text.split("n").map((line, idx) => <p key={idx}>{line}</p>)}
Don't forget the key if you're iterating React component.

All react js Questions

Ask your interview questions on react-js

Write Your comment or Questions if you want the answers on react-js from react-js Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---