When To Use React Instead Of Hotwire In Rails 7?

Sdílet
Vložit
  • čas přidán 18. 08. 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

Komentáře • 71

  • @Deanin
    @Deanin  Před rokem +27

    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 Před rokem +31

    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  Před rokem +7

      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.

  • @StevenSeagull777
    @StevenSeagull777 Před rokem +11

    I always knew react + rails is the ultimate combination to get a decent job in long run. I remember when I decided to start learning web development so I wanted to learn rails, because the pay is the best. Then find out react is kinda better for front end so I wanted to use both of them to maximize my chances to get first job. First I was using importmaps which are absolutely useless and I wasted so much time trying to set it up so I gave up. Then I find out that I can use esbuild which is 10x better. I understand what you trying to say here. In my opinion you better off learning react + rails mainly.

    • @Deanin
      @Deanin  Před rokem +6

      Yeeaah, I personally wouldn't advise someone to learn pure Rails if they're looking for a job. It's just a bit unrealistic when you consider how much more prevalent the competition is lol. I usual try to steer them towards MERN or .Net just because it's a lot easier to find a job that is searching for some of those skills.
      ---
      As for importmaps, they're easier to use if they're all you need to use. Just make sure to check that they work for the product you're working on and you should be fine.

    • @markpostura
      @markpostura Před 10 měsíci

      @@Deanin Good morning thanks for the content, where would you recommend me to start to learn how to use react on rails? @StevenSeagull777

    • @mariaineslucas3196
      @mariaineslucas3196 Před 6 měsíci

      I’m in the exact same situation where I’m trying to combine Three JS, React and Rails and close to losing my mind. Now looking for comparisons like this because I’m just getting so confused between all these packages and versions of Rails

  • @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.

  • @hautbois78
    @hautbois78 Před 2 měsíci

    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.

  • @awksedgreep
    @awksedgreep Před rokem +3

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

  • @DevBishwasBh
    @DevBishwasBh Před rokem +7

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

  • @sheriffawzy2998
    @sheriffawzy2998 Před 8 měsíci

    YOU ARE TOTALLY RIGHT, THANKS A MILLION.

  • @ashutoshdevshali2933
    @ashutoshdevshali2933 Před rokem +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 Před rokem

      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.

  • @RogerioNascimento1
    @RogerioNascimento1 Před rokem

    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

  • @dmitriyobidin6049
    @dmitriyobidin6049 Před rokem +2

    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.

  • @bj0rnen
    @bj0rnen Před rokem +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 Před rokem

      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 Před rokem

      @@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 Před 2 měsíci

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

    • @bj0rnen
      @bj0rnen Před 2 měsíci

      @@user-xedwsg monolithic repo

  • @viktornovitskyi9457
    @viktornovitskyi9457 Před rokem

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

  • @stpaquet
    @stpaquet Před rokem +2

    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  Před rokem +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.

  • @vaultek_
    @vaultek_ Před rokem +3

    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  Před rokem +2

      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_ Před rokem +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_ Před rokem +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

  • @Andy-rl8jo
    @Andy-rl8jo Před 8 měsíci

    I’d definitely appreciate a tutorial on making tutorials

  • @tapank415
    @tapank415 Před rokem +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  Před rokem

      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.

  • @kurtm9744
    @kurtm9744 Před 7 měsíci

    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.

  • @DarkSolidity
    @DarkSolidity Před 8 měsíci

    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

  • @DevBishwasBh
    @DevBishwasBh Před rokem +4

    Rails is awesome.

  • @KapnKregg
    @KapnKregg Před rokem +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 Před rokem +1

    I so wish I could like this rant again!

    • @ellerium
      @ellerium Před rokem +2

      I do removed the like and liked it again 😂

  • @SyedMSawaid
    @SyedMSawaid Před 6 měsíci

    Casual Wide Dean

  • @keeterkirk
    @keeterkirk Před rokem +1

    You’re 100% right

  • @DarkSolidity
    @DarkSolidity Před 8 měsíci

    Why would an app need 2 backends

  • @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.

  • @gsiicam
    @gsiicam Před rokem

    Good video :)

  • @ellerium
    @ellerium Před rokem

    I feel the need to like this video twice.

  • @amani_art
    @amani_art Před rokem +14

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

    • @jl789nz
      @jl789nz Před 10 měsíci +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 Před 2 měsíci

      @@jl789nzI thought the same as you

    • @GreenspudTrades
      @GreenspudTrades Před 2 měsíci

      They drastically refactor JS frameworks too every year.

  • @danielb.2873
    @danielb.2873 Před rokem +5

    Why use React at all?

  • @llejk
    @llejk Před rokem +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.

  • @lucazarts25
    @lucazarts25 Před 9 měsíci +1

    You're funny 😂😂

  • @siyaram2855
    @siyaram2855 Před rokem +1

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

    • @Deanin
      @Deanin  Před rokem +1

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

  • @ellerium
    @ellerium Před rokem +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 😂

  • @canertasanalumni5923
    @canertasanalumni5923 Před rokem

    Tell people use Emberjs, Ember + Rails

    • @SeanLazer
      @SeanLazer Před 7 měsíci +1

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

    • @canertasanalumni5923
      @canertasanalumni5923 Před 7 měsíci

      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

  • @PurelyDef
    @PurelyDef Před 9 měsíci

    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

  • @cyrilchubenko2657
    @cyrilchubenko2657 Před 9 dny

    I don't like where the RoR is going

  • @emiribrahimbegovic813
    @emiribrahimbegovic813 Před rokem +1

    take this ANGRY comment!

  • @seriouslyiknowhowtoread
    @seriouslyiknowhowtoread Před 4 měsíci

    Why use react? Because it pays the bills .

  • @ramonchavez981
    @ramonchavez981 Před 6 měsíci

    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.

  • @opjoter
    @opjoter Před rokem

    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...