DEV Community

Discussion on: JSX: In A Nutshell

pabloabc profile image
Pablo Berganza (he/him)

The same way a parser knows how fn() is a function call, or how if {...} is an if block! 😅

Don't see JSX as a templating language, see it as part of the JavaScript syntax! You don't need a tag to specify it is JSX because it already is "valid" JavaScript 😊

Aside note: actually the browser doesn't understand JSX at all. Babel is the parser that turns JSX into React.createElement, and that's what the browser sees (and what it can understand) in the end. The above mental model is approximately correct, just don't try to use JSX directly in the browser 😅

Thread Thread
bawa_geek profile image
Lakhveer Bawa

ahhh, got the point here; Don't see JSX as a templating language, see it as part of the JavaScript syntax! You don't need a tag to specify it is JSX because it already is "valid" JavaScript.

Thank you man, Thanks a lot

Thread Thread
pabloabc profile image
Pablo Berganza (he/him)

Glad I could be of help!