Why do people put { ” ” } in their React / JSX?

This is used to put an explicit space in a text block, since leading and trailing spaces are ignored at compile/transformation time when there is another tag.

Example:

<div>
 Text
 <a>some Text</a>
</div>

Will result with Textsome Text on the screen. (see the missing space)

<div>
 Text{' '}
 <a>some Text</a>
</div>

Will result as wanted with Text some Text on the screen.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)