Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The one thing I thought was IMHO missing from this article was JavaScript.

In HTML, it is pretty natural to add white space (i.e. text nodes containing white space) between all elements. You basically only have to worry if you want to avoid that.

In JavaScript, the opposite is true. If you want to create a text node, you have to do so explicitly. If you just create elements and append them to the same parent, they will be added without whitespace.

I am not sure how JSX behaves in this regard. Last time I checked it was more like JavaScript than HTML, which was of curse very confusing for people.



iirc, in JSX whitespace between elements/components is ignored unless it’s part of a string inside a JSX expression e.g. {β€œ β€œ}.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: