I know this is an old question, and this doesn't exactly do what you asked for, but rather than editing the string, what you want to achieve is probably be solved better using the CSS white-space: nowrap attribute:
Well it's very hard to type on here without it disappearing, so I'm adding a little whitespace so everyone can see it. If you remove the whitespace from this tag < nbsp />, then you'll be able to use a non-breaking space in React.
React translates this JSX tag into a non-breaking space. Weird quirk: This must also be used on the same line as the text you want to space. Also, non-breaking spaces with this tag don't stack in React.
In my opinion, the best way to display is to print it explicitly in the code. (It is sad that react does not support such simple, basic, features out of the box.)
If react's jsx throws error, it means nbsp was put incorrectly into code.
Simple rule is that all special characters should be wrapped with tag.
In most cases it's just possible to put it as it is:
return <span>{n} followers</span>;
But, if you want to add something like that:
// this will cause an error
{number > 0 && (<strong>{number}</strong> )}
you need to wrap part with nbsp with parent tag (for example, with empty):