<story><title>The Case for React.js and ClojureScript</title><url>http://murilopereira.com/the-case-for-reactjs-and-clojurescript</url></story><parent_chain><item><author>chao-</author><text>Almost everything I&amp;#x27;ve seen about React makes me happy. However there are some parts for which I do not understand everyone else&amp;#x27;s excitement. This presentation contains a great example on slide 53 when it says:&lt;p&gt;&amp;quot;No Templates!&amp;quot;&lt;p&gt;With an exclamation mark, even! What it doesn&amp;#x27;t tell me, is what is wrong with templates in the first place? I happen to like them versus the feeling the alternative gives: Awkwardly-mixed-paradigms and using string concatenation while attempting to represent one language within another.&lt;p&gt;Can someone who dislikes templates explain? Or maybe explain what a template means to you, as perhaps we&amp;#x27;re not all thinking about the same thing when someone says &amp;quot;No Templates!&amp;quot;</text></item></parent_chain><comment><author>zoomerang</author><text>I agree very strongly, but I can understand the opposite viewpoint.&lt;p&gt;For me, I like to write HTML in HTML. While I&amp;#x27;m primarily a backend programmer these days, I&amp;#x27;ve spend a considerable portion of my career writing HTML, so I&amp;#x27;m very familiar and fluent in it.&lt;p&gt;As such, to me, writing HTML as HTML with annotations for data bindings and loop is a much better approach. Anything else just gets in the way of my workflow. AngularJS is the only tool I&amp;#x27;ve used so far that really nails this properly. (At least since Zope)&lt;p&gt;However a lot of developers aren&amp;#x27;t HTML guys. They think in code, and to them HTML == DOM == a Tree structure. So it makes sense for them to be returning a tree.&lt;p&gt;I quite religiously think the latter is the wrong approach and results in less maintainable code. Instead of having a single template with the entire page clearly laid out, you end up with small snippets of HTML rendered all over the place.&lt;p&gt;This becomes even more jarring when you&amp;#x27;re working with designers that aren&amp;#x27;t coders. I manage a team of 7, and Using HTML-based templates means that my designer can write fluent AngularJS templates without developers having to do a thing. The alternative is for the designer to mock something up, and then for developers to cut it up into tiny little pieces and rewrite it in whatever DOM abstraction is the flavour of the month. Try reskinning a site made up of hundreds of small snippets of DOM vs a few complete HTML templates - the latter is far easier.&lt;p&gt;Some developers like to write Dom in Javascript because they know Javascript and don&amp;#x27;t want to learn another language.&lt;p&gt;To me, the idea that templates are bad because somebody doesn&amp;#x27;t want to learn another language just reeks of anti intellectual bullshit. Angular template aren&amp;#x27;t difficult.&lt;p&gt;I&amp;#x27;ll finish off this post by adding that I &lt;i&gt;much&lt;/i&gt; prefer reactive code over imperative observables or dirty-checking, but Angular templates work so ridiculously well it&amp;#x27;d feel like a step backwards moving to another framework that didn&amp;#x27;t have them. My dream toolchain would use something similar to Angular templates, with FRP code behind the scenes.&lt;p&gt;tl;dr To somebody used to writing HTML, building a page by emitting snippets of DOM inside Javascript is about as annoying as trying to write Javascript by emitting snippets of code in XML.</text></comment>
<story><title>The Case for React.js and ClojureScript</title><url>http://murilopereira.com/the-case-for-reactjs-and-clojurescript</url></story><parent_chain><item><author>chao-</author><text>Almost everything I&amp;#x27;ve seen about React makes me happy. However there are some parts for which I do not understand everyone else&amp;#x27;s excitement. This presentation contains a great example on slide 53 when it says:&lt;p&gt;&amp;quot;No Templates!&amp;quot;&lt;p&gt;With an exclamation mark, even! What it doesn&amp;#x27;t tell me, is what is wrong with templates in the first place? I happen to like them versus the feeling the alternative gives: Awkwardly-mixed-paradigms and using string concatenation while attempting to represent one language within another.&lt;p&gt;Can someone who dislikes templates explain? Or maybe explain what a template means to you, as perhaps we&amp;#x27;re not all thinking about the same thing when someone says &amp;quot;No Templates!&amp;quot;</text></item></parent_chain><comment><author>DougBTX</author><text>&amp;gt; and using string concatenation&lt;p&gt;React.js uses a &amp;quot;virtual DOM&amp;quot; made up of JavaScript objects, so there isn&amp;#x27;t any concatenation of HTML strings, just generation of virtual DOM objects. The next step up from that is their JavaScript variant, JSX, which has HTML-like syntax for instantiating those virtual DOM objects.&lt;p&gt;JSX looks quite like HTML templates, except the programming logic (which in a templating language might be {{if foo}} ... {{&amp;#x2F;if}} etc) is plain JavaScript. Introduction to JSX here: &lt;a href=&quot;http://facebook.github.io/react/docs/jsx-in-depth.html&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;facebook.github.io&amp;#x2F;react&amp;#x2F;docs&amp;#x2F;jsx-in-depth.html&lt;/a&gt;&lt;p&gt;Slide 49 has a bigger example, and the slide before shows the plain JavaScript version: &lt;a href=&quot;http://murilopereira.com/the-case-for-reactjs-and-clojurescript/#/49&quot; rel=&quot;nofollow&quot;&gt;http:&amp;#x2F;&amp;#x2F;murilopereira.com&amp;#x2F;the-case-for-reactjs-and-clojurescr...&lt;/a&gt;</text></comment>