Facebook’s New React JavaScript Library Tutorial Rewritten in AngularJS

React vs. AngularJS: Let’s make an app to compare!

Update: Thank you guys for voting me up to the top of Hacker News!

Update: React was a side project that I reviewed the day it launched, and you guys liked this post. Please try Rate My App, where you improve every morning with daily video feedback for new side projects from Show HN and Product Hunt. Thanks!

Facebook React is a new JavaScript framework. I found their official tutorial for creating a comment box (like Disqus or Facebook Comments) and I wanted to re-create this app in AngularJS.

In the AngularJS version below, the HTML speaks for itself.

And the entire JavaScript required to

1) power the form, 2) redraw the comments, and 3) render Markdown in HTML

appears below.

Of course, we may want to save the new comment to a server, so we simply add a few more lines:

And if we want to automatically update the comments every 5 seconds, we simply add the following lines:

For an interactive demo, I created a jsFiddle here: http://jsfiddle.net/vla/Cdrse/

What does the Facebook “React” tutorial look like? Here you go!

That’s all for today! Visit Rate My App for short video reviews of similar projects or follow me on twitter: @vla and @ratemyapp.

If you like this post, and want more, I post daily videos of new side projects found on Hacker News and Product Hunt. Once you visit Rate My App (@ratemyapp, ratemyapp.com), sign up for the newsletter, because we’re launching a podcast so you can take the show to the shower or your morning commute! For the Rate My App newsletter, please enter your email address here.

You can follow me on twitter: @vla. I’m vlad on Hacker News and GitHub. No recruiters, please.