3 ms·
> What about .jsx though? I think it's a fine enough solution, but the fact that it's a different syntax from your standard js objects encourages people to con
by tolmasky 6y ago
> What about .jsx though?
I think it's a fine enough solution, but the fact that it's a different syntax from your standard js objects encourages people to consider the VDOM objects as "not normal data", but they are. Notation as a tool of thought innit.
This is incidental. JSX can be extended beyond just representing HTML nodes, and IMO has far cooler consequences as first class .bind() notation vs. its current use as an alternate call notation (which already has a notation of course in the form of appending parenthesis to an identifier). Namely, you can begin to curry JSX nodes. For the purposes of discussing HTML specifically, you can do things like:
const myPre = <pre style = "color:red">;
<myPre>hi</myPre>
You can actually then take this and end up with a more powerful object notation too (especially for representing tree-like data). I discuss this extensively in my blog post here: http://tolmasky.com/2016/03/24/generalizing-jsx/ http://tolmasky.com/2016/03/24/generalizing-jsx/