How to multiple non-breaking spaces in React?

Viewed 1816

How to have have four or five consecutive non-breaking spaces in HTML using jsx and React. I try

`asdf${'      '}`

but it only renders one space. How do I do this in React?

2 Answers

You can use CSS white-space property for it

<div style = {{ whiteSpace: "pre" }}>{`asdf${'      '}`}</div>

Let me know if it works.

You can use non-breaking space html entity inside render

<div>&nbsp;&nbsp;</div>
Related