Reputation: 18133
After reading some tutorials, I've found that the authors write {' '}
between statements. is it have some special meaning or it's just a convention?
return (
<form>
<input type="text" placeholder="Search..." />
<p>
<input type="checkbox" />
{' '}
Only show products in stock
</p>
</form>
);
Upvotes: 0
Views: 995
Reputation: 71
The whitespace is required to separate the checkbox from the text. Otherwise the JSX compiler remove all the whitespace and the new lines placed just for beautify the code.
You can find a good explanation here.
https://github.com/facebook/jsx/issues/19
Upvotes: 2