Re: Reactjs for Plone UI Toolbar

Timo Stollenwerk <tisto-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <[email protected]>
Am 29.05.2014 12:06, schrieb Asko Soukka:
> Nathan Van Gheem wrote:
>> We're using React for docs in them mockup project and underscore
>> templates(with jquery $('<html>') magic) basically everywhere else. We
>> want to eventually move to using React. This has been in discussion.
> 
> Have you discussed / tried (pre)compiling React DOMs from HTML via JSX 
> transform, or are HTML templates simply anti-pattern with React?

It seems HTML templates are considered indeed an anti-pattern in React:

http://www.infoq.com/news/2013/06/facebook-react

> I'm not yet familiar with React, but the existing code in mockup-core 
> looks scary (at least with TAL+METAL+XHTML background):
> 
> e.g. https://github.com/plone/mockup-core/blob/master/js/docs/page.js

Compare that code (generating a list for instance) with how you would
write a template to iterate over a list in Angular:

<ul>
  <li ng-repeat="item in items">
    {{item.title}}
  </li>
</ul>

This looks and feels (at least to me) like TAL. It is really dead simple
for a Plone developer to learn Angular (at least the template part). You
just write that code directly into your HTML structure (it is valid HTML
and can be spread across multiple templates (directives) if necessary).
No need to learn any obscure JS template language.

Another, far more important, reason to use Angular is that it forces
developers to write small, re-usable, and testable components. This
usually leads to code that is much more readable.

Cheers,
Timo

------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.