Adding line break to defaultMessage

79 views Asked by At

How to add multiple line breaks to a long sentence using intl.formatmessage?

I tried the following solution but it didn't work for me. Any idea/solutions?

intl.formatMessage(
  {
    description: 'A message', 
    defaultMessage: 'My name is Breaking line {br} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sed diam quis turpis pellentesque commodo. Vivamus tristique, mauris et consectetur viverra, velit nisl consequat ipsum, eu lobortis tortor mi sed justo. {br} Fusce ac faucibus quam, nec interdum ex.{br}  Nullam ornare, nunc in malesuada finibus, lectus ex convallis est, a tincidunt nunc lectus id ligula.', 
  },
  {
    values: {
br: <br />
},
  } 
)

Output:

My name is Breaking line {br} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed sed diam quis turpis pellentesque commodo. Vivamus tristique, mauris et consectetur viverra, velit nisl consequat ipsum, eu lobortis tortor mi sed justo. {br} Fusce ac faucibus quam, nec interdum ex.{br} Nullam ornare, nunc in malesuada finibus, lectus ex convallis est, a tincidunt nunc lectus id ligula.

0

There are 0 answers