I've also "re-created React" multiple times before it was actually created.
Diffing somehow always ended up being thr most natural way tondo things in the end.
My selling point in the end were the components
I've also "re-created React" multiple times before it was actually created.
Diffing somehow always ended up being thr most natural way tondo things in the end.
My selling point in the end were the components
What would be different if
Document.createElement('a')
Would look like <a/>
?The rest would still be imperative code.
The second one is declarative and leaves it up to the receiver to handle however they seem fit.
I'm not arguing one is better or worse, or that we would be better off if we we're using the JSX way with native support in the browsers, just explaining how I see the differences between the two.
var elem = <a href="#test">Test</a>;
over var elem = document.createElement("a");
elem.href = "#test";
elem.innerText = "Test";
jQuery allows one to do something similar to JSX (which is nice): var elem = $("<a href='#test'>Test</a>");For an example of a system where the programming language and document generator share data structures, look at Hiccup (and Reagent). One of their very first examples is putting a loop inside a list. There's no special API for the attributes -- it's just an ordinary map. There's no special API for the children -- it's just an ordinary vector.