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 😅
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.
Thanks for the reply, but there is no starting tag like <?php , how parser knows its jsx not html.
Is it true that , if there are no quotes, js compliler automaticly assumes its jsx code.?
The same way a parser knows how
fn()
is a function call, or howif {...}
is anif
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 😅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
Glad I could be of help!