When To Use React Instead Of Hotwire In Rails 7?

Поділитися
Вставка
  • Опубліковано 18 сер 2022
  • I've seen too many people be rude and just assume Hotwire is always the best solution for everyone all the time. It made me a sad panda.
    Join this channel to help support these videos:
    / @deanin
    Follow me on social media:
    linktr.ee/deanin
    If you liked this video, please consider subscribing: t.co/RZ4EwP0F2a
    #Deanin #Software #Programming

КОМЕНТАРІ • 68

  • @Deanin
    @Deanin  Рік тому +28

    So I made another rant... 😅Not aimed at anyone who watches these videos, but I might have received one too made rude DMs because I made a React tutorial, and seen one too many bad Reddit takes recently lol. Don't cancel me pls.

  • @SupeRails
    @SupeRails Рік тому +32

    Thanks for your contribution in Rails + React tutorials.
    Indeed, the market demand for Rails + React jobs is 10x higher than for Hotwire + Rails jobs.
    Thus, going all-in with React is a safer bet.
    Me personally, I love the Hotwire approach because it allows me to be much more productive as an solo developer working on a project.
    Whereas having React in small projects is overkill.
    In large projects it can make more sense.
    But again, if it's a project with 4+ devs, you can have a dedicate React person that has nothing to do with Rails, and the Rails devs can just be supplying API endpoints.
    So with that logic, it makes no sense for me as a Rails dev to invest my time into enhancing my React skills: I'd better be great at Ruby & Rails API.

    • @Deanin
      @Deanin  Рік тому +8

      Yeah I mean to each their own. I wouldn't expect someone to use React over Hotwire in the same way I don't expect them to use Hotwire over React. It's just an issue for me when people try to pass their opinions off as the optimal solution when some guy is just trying to get a job. Personally covering React and importmaps without JSX made me throw up a little, but that exact video was made because that solution was required for someone's take home interview. So I'm not a fan, but there's clearly demand so when people lose it on Reddit about not doing it the Rails way I'm like, come on man. The person is just trying to feed their family lol.
      I used to work in a job where pretty much every problem boiled down to doing it in a ridiculous suboptimal way, so I can appreciate that sometimes your hands are tied lol. I think the epitomy of this was a legacy application that had a literal two week setup process before we wrote some documentation on how to do it and found out you needed to comment out the tests to make it work. 🤡 I wouldn't advise commenting out tests, and yet that ended up being the solution for a solid 3 months 😭
      As for the proper Rails way of doing things and Hotwire, I'll never hide that I'm not a Rails dev at heart. That's why I send people to you. 😂 I still get caught using findElementById in my stimulus controllers.

  • @hautbois78
    @hautbois78 5 місяців тому +1

    The timeliness of this video is spot on for me. I have been tasked with re-writing a legacy Sinatra app in Rails 7. Our current apps all have React frontends (because our FE devs are React devs). Planning out this simple project brought up a lot of questions regarding maintainability for the team. Thank you for sharing your point of view and always being a great resource.

  • @DevBishwasBh
    @DevBishwasBh Рік тому +8

    This comment is to help the rails community. You're awesome.

  • @rumble1925
    @rumble1925 Місяць тому +1

    I'm a bit surprised inertiajs isn't talked about more in the rails community. It's basically glue between your server and frontend routing. You get nice routing and ability to just use frontend frameworks for what they excel at, but keep your data handling and state on your server.

  • @guillermoemmanuelsanchezin1664

    This wasn't the video I was looking for but I watched it completely because I highly relate to what you were saying.
    I'm finishing a degree which does not have a really good market in my country, so I decided to try programming and started on October of this year. If it is difficult for people to get a junior position just imagine how difficult it is for the ones who don't have a CS background. I know that in Tech it doesn't matter if you're studying a CS degree, but I heard that some platforms can potentially reject applicants if they don't fulfill that background requirement. So one must try to make their profile as marketable as posible, and I think react+rails should be the go way in doing a portfolio for a newbie trying to find their first job.

  • @awksedgreep
    @awksedgreep Рік тому +3

    “Hoping DHH doesn’t reinvent rails again” Love it. I feel like Rails 7 should finally be a way forward. Fingers crossed.

  • @ashutoshdevshali2933
    @ashutoshdevshali2933 Рік тому +4

    Hey man, I personally feel that rails as a backend api is the best use case for it. But following all the buzz around hotwire I gave it a try last week. It was quite easy to do stuff without touching frontend as what it claims to be but i don't know I just don't feel comfortable enough and I would still go with rails as an api and react in frontend for a project I know is going to be much more than an MVP. Yes hotwire and stimulus could be a savior when we are building a customized admin in rails. Either the whole community has to start using it or it will just remain as a thing as good to know.

    • @clumsyjester459
      @clumsyjester459 Рік тому

      Sounds like you need to give Unpoly a try. It can turn any server-side rendered page into an SPA and has a much simpler architecture and doesn't require you to change your backend at all.

  • @dmitriyobidin6049
    @dmitriyobidin6049 Рік тому +3

    RoR + Hotwire is perfect(from my pov) for 1 type of projects - internal systems/portals for enterprises that are not computation-heavy. It will give you fastest development speed, iterations, etc.
    Others - it's always a compromise, when you have to take into consideration product market and job market.

  • @vaultek_
    @vaultek_ Рік тому +4

    Guys if you are angry listen to this . Dean is just giving his honest view of this monopoly that guys in reddit do, and plus on that, the stack that I use for my startup is rails in the backend , integrated with graphql because I really love the separations of concern in rails you have models, mailers, resolvers , mutations etc... and next js and apollo in the frontend, and is going absolutly good fine and perfect , and also in the case of action cable , you don't need that, just use pusher more best than everything , well tested proper api, and bla bla bla.

    • @Deanin
      @Deanin  Рік тому +3

      Haha it's all good. I think in general people are going to have a bit of a tribalistic defense of whatever their choice is. For me personally, I'll defend my choice of using the right tool for the job which quite often isn't "The Rails Way"
      I'm just happy to have a video to link to in the future when I get the odd comment on a video asking me why I didn't use Hotwire instead of
      If anyone actually gets heated over a video like this, that probably says more about them than anything else lol.
      How is next js and Apollo working out by the way? I still haven't had the chance to look into nextjs but it seems interesting from what I've seen from Fireship videos

    • @vaultek_
      @vaultek_ Рік тому +2

      @@Deanin yeah dude people are soo crazy about something that no one cares about , if you use react over hotwire, nobody will care, I am just telling them that you are a content creator and because of that you are teaching everything, I really like next and apollo, it works fine to me, and also I am managing all my libraries with nx monorepo, so in nx you have a folders called app and libs, app is for your apps and cypress e2e and in libs you have your shared libraries with jest and others, and because I maintain 2 startups I can shared that libraries and published them and use them in other apps, it really good, like rails engines

    • @vaultek_
      @vaultek_ Рік тому +2

      @@Deanin and also take a look at next js , it has a lot of cool features, routes folder structure, in react that is a pain the but, I have a project in react that have more than 100 routes and my index file is like hell, to index on, so that a point for next, and I also you can do any of this fetching technicks , server side rendering, static site generation, client side rendering like react and other 2 that I don't use them that often , and you know the CEO gap of react, next handles that very well, there is a lot , I recommand to take a look at it, have a good day deanin

  • @bj0rnen
    @bj0rnen Рік тому +2

    I’ve been working with Rails for about 13 years or so and the only front end Rails thing I use is their UJS library. Where I work right now, we have a more traditional web app that uses JS on top of server side HTML rendering, and parts that are highly interactive are written in React.

    • @clumsyjester459
      @clumsyjester459 Рік тому

      Have you tried Unpoly? For 95% of all projects React is still overkill and you can get a much simpler setup that still behaves like an SPA with Unpoly.

    • @bj0rnen
      @bj0rnen Рік тому

      @@clumsyjester459 for simple things we mostly use vanilla JS. I haven’t tried Unpoly but I’ll give it a look.

    • @user-xedwsg
      @user-xedwsg 4 місяці тому

      Is everything in a single monolithic app? Or is the react stuff in a different repo/project?

    • @bj0rnen
      @bj0rnen 4 місяці тому

      @@user-xedwsg monolithic repo

  • @RogerioNascimento1
    @RogerioNascimento1 Рік тому

    Thanks for the video. I’m with you on this.
    I struggle sometimes to understand why there’s so much passion involved in technological decisions. Maybe that’s the main reason system architectural decisions must be taken by the most experienced developers in the project.
    We need to use the best tool for the scenario always…. And “best tool” must be comply of what’s best within the entire architecture.
    There can always be middle ground decisions:
    - there could be a gradual migration from one technology to the other…
    - there could be some pre-existent skill that is valid to be used for the moment
    - sometimes you need fast-and-dirty and then you have time to come back and fix later
    And there are the cases you mentioned: job interview, etc etc
    There are plenty of real world scenarios… and cheering up for one technology in despite of the other.. is professionally immature

  • @kurtm9744
    @kurtm9744 9 місяців тому

    Has anyone done a deep dive into Svelte vs. Stimulus + Turbo? I like that Svelte lets you compartmentalize all HTML, CSS, and JavaScript together into Svelte files. But beyond that, does anyone know if it has more syntactic sugar or shortcuts for front end things like sorting data or image carousels? I feel like Stimulus has less of that and would require more custom JS.

  • @stpaquet
    @stpaquet Рік тому +3

    You can bring part of React in Rails. I mean that it can be used as an alternative to view_component with the benefit of React. Also, you are right: a lot of existing projects have multiple backends... thus React being used actually.
    There is one thing I would not use in a new project: importmap. it looks like coffee script to me ;-) Most of the existing libraries are easier to import using webpack or esbuild (which I prefer over webpack )
    Last point: Stimulus! Yep, I like it. I see it as a way to better support Javascript in Rails app. Previous versions of Rails were a bit messy on how to import and structure and reuse JS in Rails projects. Stimulus brings a framework that is structuring JS in Rails projects in a way that is closer to the industry standards.
    Thanks for sharing your opinion, which I found very balanced and rooted to the real developer's life.

    • @Deanin
      @Deanin  Рік тому +3

      Importmap and Coffeescript is a hilarious comparison, thank you for that haha. Completely agree with you.
      In general I don't really mind what people use, I think as long as someone has the option to use something and they want to, then more power to them. I'll give them my 2 cents if I feel it's warranted, but then I'll still do a tutorial on it because other people probably need/want to know.
      Then again, one of the first tutorials I did on this channel was running Python inside a Rails app, so I'm probably not the best influence hahaha.

  • @viktornovitskyi9457
    @viktornovitskyi9457 Рік тому

    I totally agree with what you say. Thanks for the video.

  • @sheriffawzy2998
    @sheriffawzy2998 10 місяців тому

    YOU ARE TOTALLY RIGHT, THANKS A MILLION.

  • @tapank415
    @tapank415 Рік тому +2

    I personally go with whatever stack throw me at, just give me enough time to get a feel of it. if docs & available resources are good enough! i'm ready to rock. advice for newbie devs: Learn/Understand the architecture not the framework specific features. & also speaking of which tech stack to use its really depend upon scenario, for personal projects go with whatever you want, commercial one needs team discussion before making any decisions yourself, also must look at team expertise, time & budget, client requirements etc.

    • @Deanin
      @Deanin  Рік тому

      Yeah, completely agree. I think being able to appreciate the team/business side of it might be something that comes from experience. So that might be on me for losing sight of the fact that not everyone has that experience yet.
      It's just frustrating seeing how reluctant people can be to help when someone is veering off the DHH path with Rails lol.

  • @amani_art
    @amani_art Рік тому +14

    Rails frontend doesn't make any sense. Things change every few years

    • @jl789nz
      @jl789nz Рік тому +2

      You could make the same argument about any JS framework as well. Using Rails for front end makes a lot of sense in a lot of cases. For me the best reason to learn React is for getting a job, not because it's a better way to build out a Rails app.

    • @thevocoder
      @thevocoder 5 місяців тому

      @@jl789nzI thought the same as you

    • @GreenspudTrades
      @GreenspudTrades 5 місяців тому

      They drastically refactor JS frameworks too every year.

  • @DarkSolidity
    @DarkSolidity 11 місяців тому +1

    Why would an app need 2 backends

  • @KapnKregg
    @KapnKregg Рік тому +1

    What's funny is that the rest of the industry (the React/TypeScript/JavaScript world) is starting to slowly move back toward the monolith architecture. You can see this with the move to things like Remix and RedwoodJS and BlitzJS to a lesser degree.

  • @JonathonPickett
    @JonathonPickett Рік тому +1

    I so wish I could like this rant again!

    • @ellerium
      @ellerium Рік тому +3

      I do removed the like and liked it again 😂

  • @ellerium
    @ellerium Рік тому +1

    I feel the need to like this video twice.

  • @danielb.2873
    @danielb.2873 Рік тому +6

    Why use React at all?

  • @DevBishwasBh
    @DevBishwasBh Рік тому +4

    Rails is awesome.

  • @gsiicam
    @gsiicam Рік тому

    Good video :)

  • @keeterkirk
    @keeterkirk Рік тому +1

    You’re 100% right

  • @Andy-rl8jo
    @Andy-rl8jo 10 місяців тому

    I’d definitely appreciate a tutorial on making tutorials

  • @SyedMSawaid
    @SyedMSawaid 8 місяців тому

    Casual Wide Dean

  • @DarkSolidity
    @DarkSolidity 11 місяців тому

    Rails backend with react frontend seems like the natural solution to the problem. After learning frontend development react would be the better solution for a responsive interface

  • @melchior-chr.v.brincken8006

    The other problem is, that companies do not take on Junior RoR devs, because they cost them the first year and than jump ship for a better pay. React might be the way for me to get onboard.

  • @lucazarts25
    @lucazarts25 Рік тому +1

    You're funny 😂😂

  • @siyaram2855
    @siyaram2855 Рік тому +1

    I have posted a comment with a link hope it doesn't get flagged.

    • @Deanin
      @Deanin  Рік тому +1

      It didn't get flagged but it also didn't give me a notification for it 😮‍💨

  • @llejk
    @llejk Рік тому +2

    Uh, well but is this a rant about hotwire? Seems this is more about a very specific case of people advising for frameworks despite nobody asked.

  • @PurelyDef
    @PurelyDef Рік тому +1

    I think there are a lot of contrived examples in this rant that aren’t needed tbh. React is just.. a better framework. Rails is good at backend infrastructure, but the front end stuff is an absolute nightmare. Stimulus + turboframes is just awful to work with for dozens of reasons. If you want to make a VERY simple static website, like the websites we had in the 90s, then rails is the way to go. If you want to make a large, modern application that has dynamic flows and reactive components, react is just far, far better. The hundreds of hours you'll waste trying to debug stimulus and turboframes just isn't worth it

  • @ellerium
    @ellerium Рік тому +1

    I’ll create another comment only to increase the # of comments on the video. Because it talks so much with my opinion I would believe if you say you just read my mind 😂

  • @ramonchavez981
    @ramonchavez981 9 місяців тому +1

    Whatever happened to PI planning? I like your videos but you seem to be a little bias about hotwire, hotwire has been designed for people that know ROR and some JS, and make it easier for them to implement SPAs at a very easy level without having to require them to learn a whole new framework. And yes hotwire isn't all SPA, but it works well for it. And don't forget, that ROR is an amazing framework for creating applications very fast.

  • @canertasanalumni5923
    @canertasanalumni5923 Рік тому

    Tell people use Emberjs, Ember + Rails

    • @SeanLazer
      @SeanLazer 9 місяців тому +1

      If someone is trying to get a job I'd say that's not very good advice

    • @canertasanalumni5923
      @canertasanalumni5923 9 місяців тому

      Yeah but it depends actually. Ember and Rails is a very rare combination not many jobs there. But if you find a junior job in startup then after you have 2-3 years experience with it companies who looks for ember and rails combination, you are the number one candidate most of the time. Thats how I found my abroad job after 1.5 years of experience. I think rails has better community then ember. However you can jump only Ember or Rails job afterwards(which I already did it 4 months ago)@@SeanLazer

  • @cyrilchubenko2657
    @cyrilchubenko2657 2 місяці тому

    I don't like where the RoR is going

  • @emiribrahimbegovic813
    @emiribrahimbegovic813 Рік тому +1

    take this ANGRY comment!

  • @seriouslyiknowhowtoread
    @seriouslyiknowhowtoread 7 місяців тому

    Why use react? Because it pays the bills .

  • @opjoter
    @opjoter Рік тому

    The man really compared "market share" of apples and oranges (React vs Rails) by showing number of google searchs, you can't be serious man...