Hacker News new | past | comments | ask | show | jobs | submit login

The article makes a comparison to react, but that’s a front end library. Does rails also do front end?!



Yep, it builds HTML on the server side and sends it to the browser through normal get requests. Instead of constructing HTML in a mix of JS + HTML (JSX) you typically write a mix of Ruby + HTML called ERB.


Doesn't Ruby also have an HTML-over-websocket library that Basecamp built for Hey and released open source? (at least a year or two ago they said they would release it) This would be similar to Elixir's LiveView I think.


Yep, hotwire. It's still running everything on the server in that case though where ruby templates are generating HTML.


So you have to wait for a page refresh any time you do something on the page?


Yep, it's like every other MVC or server side framework. You can still send client side JS for interactivity, and these days there are small jquery-like micro frameworks like petite-vue, alpinejs, stimulus, etc. that are made to sprinkle in interactions where necessary. If you want the smooth SPA-like experience there are systems like hotwire or htmx which effectively hide all the page reloading.


That sounds like a terrible user experience.


You already are used to it. Lots of the web is rendered on server.


Sure, zero-js solutions are fine for marketing pages. But for an application you wouldn't want to wait for a page refresh when doing anything.


React is a client side framework (no, it's not a library even if they say it is), not an "app".


Yes, Rails has a view layer (frontend).


I’ve never used rails, but you can actually write code that runs in the browser on the front end, in Ruby? Or is it more of a server rendering technique.


You can write HTML that includes javascript (bundled with all kinds of JS libraries if you need). But you aren't writing ruby code that turns into something that directly executes in the browser.

Although with WASM I'm sure you could write ruby that also runs in the browser (no one really does this AFAIK).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: