Live data from Hacker News

Modern Front-end in Rails

evilmartians.com

11–20 of 150 posts

Re: Modern Front-end in Rails

#13
Hm. While I think it's awesome that the Rails community is moving towards adopting modern JS practices, from this post, it's not making a very good case for _why_ you'd want to do this.

Modern JS is lovely to write compared to ES5, but this tutorial doesn't write any yet! Perhaps this'll be addressed in the next part of the tutorial (although doing it in a framework-agnostic way seems tough).

Also, if I'm reading this correctly, they're still attaching an `erb` for each component, and using Rails to determine how they relate to each other? This feels a bit wrong to me, at least for dynamic web applications; when you have a framework like React controlling all of your front-end rendering, it's easy to integrate client-side routing and make it a single-page app, which means lightning-quick page transitions.

So yeah, delighted to see Rails move towards this direction, and this post is super helpful in explaining the "how" for a basic setup, but not the "why"; it also falls a bit short IMO in going "all the way", to have the front-end truly control its destiny and reap the benefits associated with that.

Re: Modern Front-end in Rails

#14

Honestly, as a Rails dev, this just seems more complicated than creating a Rails app in API mode and using #{React||Vue||Ember}} for the front-end. It's extremely easy to get started with a front-end app using vue-cli. This article spends a lot of time changing Rails' default functionality to achieve behavior similar to what vue-cli gives you by typing `vue init webpack` and answering a few questions. I understand th…

Yeah, really good point; this article is kinda halfway between "modern client-side app" and "traditional server-controlled app", and it kinda feels like the worst of both worlds (added complexity without many of the benefits)

Re: Modern Front-end in Rails

#15

Honestly, as a Rails dev, this just seems more complicated than creating a Rails app in API mode and using #{React||Vue||Ember}} for the front-end. It's extremely easy to get started with a front-end app using vue-cli. This article spends a lot of time changing Rails' default functionality to achieve behavior similar to what vue-cli gives you by typing `vue init webpack` and answering a few questions. I understand th…

Agree in principle, but any technique is frigthening at first.

Clearly for the authors this is a usual workflow - they're productive with it, and they only had to pay the complexity cost once (when figuring out things).

Once you get an integrated frontend-backend system and codebase, you start to get unique benefits:

- Server-rendered data, for avoiding superfluous ajax requests

- Simpler deployments (fewer moving pieces)

- Single codebase, less knowledge segregation

and so on.

Re: Modern Front-end in Rails

#17
Rails is still a truly incredible framework and it still moving very fast in terms of development. It’s front end stuff has always felt wrong to me and many others and we found weird ways to doing what we wanted. Rails 5 added support for a lot of them as the article points out but it still feels complicated.

Rails is awesome bc it’s opinionated but the fact that it’s ruby still lets you do what you want. I think rails needs to really dedicate some effort to better generators that ask which of these modern front end approaches do you want to use and then setup the project to just work and let me get to my coding.

Re: Modern Front-end in Rails

#18
I may be mistaken, but I think the meat of this will be in post 2?

It sounds like your taking React's render() and replacing it with ERB. But, how are you giving the ERB file access to state and props?

I suppose if it's done well, this would make it easier for Rails devs to adopt single page apps. It sounds like you're abstracting away a lot of React and creating a Rails-ier API to it.

Post reply on HN