It’s just data

React.rb

Having determined that Angular.js is overkill for my blog rewrite, I started looking more closely at React.  It occurred to me that I could do better than JSX, so I wrote a Ruby2JS filter.  Compare for yourself.  Excerpt from the React tutorial:

var CommentList = React.createClass({
  render: function() {
    var commentNodes = this.props.data.map(function (comment) {
      return (
        <Comment author={comment.author}>
          {comment.text}
        </Comment>
      );
    });
    return (
      <div className="commentList">
        {commentNodes}
      </div>
    );
  }
});

Equivalent using the Ruby2JS filter:

class CommentList < React 
  def render
    _div.commentList do
      @@data.forEach do |comment|
        _CommentBlock comment.text, author: comment.author
      end
    end
  end
end

Note: I renamed the Comment class to CommentBlock to avoid a conflict with the existing Comment API.  I wouldn’t have thought that would be necessary, but things didn’t work until I made this change.

Full source for the tutorial reimplemented in Ruby is available.


Problem with Comment has been fixed.  Underlying cause was ruby2js attempting to us an ES6 feature: const.

Posted by Sam Ruby at

a href="hhttp://www.govtjobcorner.com/himachal-pradesh-pat-admit-card///">Himachal Pradesh PAT Admit Card 2018 | HP PAT Exam Date</a> :wow this articlso amezing. i m so impress.

Posted by HRITIK at

Thanks for sharing nice information with us. i like your post and all you share with us is uptodate and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job. Cincinnati Ohio

Posted by BachJohann at

by visiting this site I found cool stuff here keep it up.

Posted by CS Assignment Help at

This is really great work. Thank you for sharing such a good and useful information here in the blog for students.

Posted by Online Programming Homework Help at

Students could often find it tough to write their academic tasks. It could lead to they not getting desired grades in the academics. Opting for our assignment help online could be ideal for such students and they can get a complete assignment solution from us. https://www.allassignmenthelp.com

Posted by assignment help online at

Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. florida map

Posted by BachJohann at

I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. healthfama

Posted by BachJohann at

دانلود قسمت چهارم فصل سوم سریال شهرزاد با لینک مستقیم, دانلود رایگان کامل قسمت 4 چهار فصل 3 سریال شهرزاد با لینک مستقیم راحت اسان کم حجم کیفیت بالا عالی, قسمت چهار 4 فصل سه 3 شهرزاد با لینک مستقیم سریال ایرانی جدید ساخته حسن فتحی بدون تگ آرم تبلیغاتی نیاز به خرید اشتراک ویژه با لینک مستقیم دانلود شهرزاد قسمت چهارم

Posted by BachJohann at

really appreciate this wonderful post that you have provided for us. thank u so much

Posted by Kerala HSC Date Sheet at

I really appreciate the post. It is very informative.

Posted by Quality hub at

I really appreciate the post. It is very informative.

Posted by Bonnie murithi at

I really enjoyed reading your post. very informative blog and very exciting to know more on this topic.

Posted by My Assignment Help at

The government of Tamil Nadu releases their results on their official websites, but the higher authority does not yet announce the

official website of publishing the results,

Posted by SSLC Result 2018 Tamilnadu at

This is very nice information share with me

Posted by website development company in delhi at

I am an antique article collector and this article is one of the best I have ever read. I hope to see the same amazing work from you in future. Thanks Marketing Assignment help

Posted by Assignment Help at

Very helpful advice in this particular post! It’s the little changes that make the largest changes. Thanks for sharing!

Posted by impossible game at

It Is Very Interesting post. Thanks for share.

Posted by Dry Cleaners Point at

I havent any word to value this post.....Really i am inspired from this post....the individual who make this post it was an extraordinary human..thanks for imparted this to us. Chinese Gender Predictor

Posted by BachJohann at

Car insurance is an agreement amongst you and the insurance organization that ensures you against money related misfortune in case of a mischance or robbery.

Posted by Car Insurance at

really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people.
Regards
Indoor Exercise Bike Reviews

Posted by Daljeet Arora at

As Js is very powerful programming language as you can use it in so many places.

Posted by itunes customer service at

Visit here

Posted by website designing company in Delhi at

Visit Website-: [link]

Posted by razzmic at

Things are very open and intensely clear explanation of issues. was truly information. Your website is very beneficial.

Posted by Writing Service at

I loved the post, keep posting interesting posts. I will be a regular reader…
I am offering dissertation help to students in UK at low price.

Posted by Dissertation Help at

Thanks for sharing this information.

Posted by Aneta at

Things are very open and intensely clear explanation of issues. was truly information. Your website is very beneficial.

Posted by Chi-Square Homework Help | AcademicPaperWriter.com at

Thanx for sharing such useful post keep it up :)

Posted by 1800 Buy Ireland Case Help at

Things are very open and intensely clear explanation of issues. was truly information. Your website is very beneficial.

Posted by Business Ethics Project Help at

I am very glad that I got to this site

Posted by jurek22aa at

I read some articles on this site and I think your blog is really interesting and has great information. Thank you for your sharing.

Posted by windows product key at

This is extremely exceptionally decent post you shared, I like the post...I am offering assignment help to students in Singapore at low price.

Posted by Assignment Help at

Thanks a lot for this wonderful post, I am really very impressed to see this..!

Posted by windows product key at

Instead of sending a generic brown or white envelope, you should seriously consider using customized envelopes. Cheap Brochure Print

Posted by Anonymous at

These are also made with a special release paper but the ink that is used for these is the same ink that is used in the traditional screen print method. custom printed shirts

Posted by joe root at

I have read your article. it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it, again!

Posted by product key at

We have many clients of liability insurance in New York that are satisfied with premium. Provide us the information we will give you quick quote rate. Liability Insurance

Posted by Liability Insurance at

Commendable job with the article! It was really informative and enriching. Looking forward to more such posts in the future. Keep us updated with what’s in store! Will surely keep frequenting this website.
<a href=https://www.makemyassignments.com/assignment-maker/ >Assignment Maker</a>

Posted by aisha oberoi at

All you have to do is keep track of how many postcards you mail out against new enquiries, leads and actual sales. fifty fiveprint company

Posted by samsung at

Men and women who are getting married traditionally celebrate this lifestyle change by holding a last hurrah to being single and free by having a hen party or a stag party. cheap event ticket printing

Posted by Anonymous at

Add your comment