ShakaCode | ShakaCode Blog | Rails On Maui Blog | Rails | ReactJs | JavaScript | Webpack | Productivity |

Using React with Rails


#1

Hey Justin!

If you read this, I’m Aaron we used to work together at Apartment List and I saw you at RailsConf this year.

Anyway, I saw your blog post about setting up React & Rails together. Really great article.

I was curious about testing with react and if you saw any problems in terms of intermittent failures due to it being JS.

at Hired we’re using Angular currently but we’ve been seeing a lot of pain using it than benefits. And have thought about using React in place of it.

Do you have your react templates compile and serve initial data of the view on the request? or do you usually have some ajax call to pull the data in?

would love to hear about your process and experiences using it!

Thanks.


#2

I can’t say enough about how ReactJS stands alone from all the other KVO (Key Value Observation) frameworks. @floydophone is absolutely right in his two videos on ReactJS. 100%!

@lifeiscontent, I’d be thrilled if you could consider doing a pull request to add some Capybara tests to the github example repo. I created a github issue to add tests to the example repo.

I always do an Ajax call from a Flux store. It works great. That being said, server side rendering would be great for content that should be SEO indexed. I created a github issue to add server side rendering to the example repo.

This video explains design philosophy of React and why MVC is not the right model for building UIs.

This video compares ReactJs vs. Key Value Observation(EmberJs) and Dirty Checking (AngularJS).


#3

I’m also a fan of React with Rails. I’ve been using the ‘Reflux’ implementation of flux - just great.

My test suite is: Teaspoon / Jasmine 1.3.1 / Guard / PhantomJS. Code and specs written in coffeescript. No JSX. My experience is: 100% bulletproof - no intermittent errors.

I tend to populate the flux stores via JSON objects rendered server-side into a ‘script’ tag, then use AJAX for updates.

I dropped Angular in favor of this stack, and would never go back. Because simplicity, lower conceptual overhead, easier to train new people.

FYI here is a link that shows some example tests: https://github.com/spoike/refluxjs/issues/148


#4

JSX, IMHO, is one of the best parts of ReactJs. And if you’re using CoffeeScript + browserify, then I can see why you wouldn’t use JSX. Wepack with ES6 + JSX + npm packages is :+1:


#5

I’m also a huge fan of JSX and really don’t like CoffeeScript. The whole, “Write code in one language and get error messages in another” is just way too big a turn-off for me…