5 ms·
The article makes a comparison to react, but that’s a front end library. Does rails also do front end?!
by jb1991 5y ago
The article makes a comparison to react, but that’s a front end library. Does rails also do front end?!
- thatguyagain 5y agoYes, Rails has a view layer (frontend).
- jb1991 5y agoI’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.
- qbasic_forever 5y agoYou 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).
- Oddskar 5y agoReact is a client side framework (no, it's not a library even if they say it is), not an "app".
- qbasic_forever 5y agoYep, 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.
- jb1991 5y agoDoesn'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.
- qbasic_forever 5y agoYep, hotwire. It's still running everything on the server in that case though where ruby templates are generating HTML.
- robertoandred 5y agoSo you have to wait for a page refresh any time you do something on the page?
- qbasic_forever 5y agoYep, 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.
- robertoandred 5y agoThat sounds like a terrible user experience.
- jb1991 5y agoYou already are used to it. Lots of the web is rendered on server.
- robertoandred 5y agoSure, 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.