I noticed some inconsistent behavior with React. Take this simple component:
export default function App() {
const string1 = "A B";
const string2 = "A B";
return (
<>
{string1}
{string2}
</>
);
}
string1
will be rendered to the page as "A B"
, but string2
is rendered as "A B"
:
Why does one get rendered as a regular space (U+0020) and the other as a non-breaking space (U+00A0) HTML entity (
)? How can I force it to render a regular space in both cases instead of a non-breaking space?