13 ms·
I would say React is (so much) better because it's functional, immutable, one-way, almost declarative. In comparison, stuff like ActiveRecord is very imperative
by nine_k 2y ago
I would say React is (so much) better because it's functional, immutable, one-way, almost declarative. In comparison, stuff like ActiveRecord is very imperative, shared-mutable-state thing. For React-based code you usually take a language with a rich static type system (TS); Rails with its design-by-contract struggled to provide type signatures, last time I checked.
One of them is much easier to reason about than the other, even though the other is enviably compact.
- freedomben 2y agoReact is a client-side library. Rails is a server-side framework. I don't see how you can even really compare these apples and oranges. Personally, I think rails and react go together very well. For apps that need rich client-side functionality, I will do a react spa with a back end in elixir/ Phoenix (which is very similar to rails). For apps that don't, just doing server-side rendering is plenty sufficient and is my preference.
- nine_k 2y agoI'm only comparing development experience and, so to say, the conceptual environment. Verily, Rails can be a pretty good and compact way to serve backend APIs for a React-based frontend. But the API boundary is the "narrow waist", its relative neutrality allows to switch backend and frontend implementations easily, or even to mix them. I've seen a React frontend seamlessly consuming APIs served by Python and Rust services, and it's hardly possible to spot which endpoint is served by what in the frontend code. Unlike on the frontend, FP approaches on the backend are not (as) widespread. Established imperative frameworks (Django, Rails, Spring Boot, etc) are still the huge majority.