Remix Single: Multiple Forms and Single Button Mutations

Поделиться
HTML-код
  • Опубликовано: 5 авг 2024
  • How to handle multiple forms in one route, and modeling mutations with a single button form. Learn more at remix.run
  • НаукаНаука

Комментарии • 68

  • @GustavoDiaz93
    @GustavoDiaz93 2 года назад +21

    Oh, man! Using a hidden input field brings me old good memories. I love Remix.

  • @someshmusunuri4233
    @someshmusunuri4233 2 года назад +24

    Remix Singles are Awesome and Ryan Florence is the best DEMO person, to the point and crystal clear. Love these.

  • @BenMcHone
    @BenMcHone 2 года назад +8

    I can't get enough of remix. Make the web simple again!

  • @sephiics
    @sephiics 2 года назад +6

    "It's what ur code doesn't do" killed me

  • @Arzen84
    @Arzen84 2 года назад +2

    So amazing what you guys have built so far! I cannot wait for more videos like this!

  • @Aquilalias
    @Aquilalias 2 года назад

    Love those videos. Great commentary and always something new to learn even with a few years of experience on my back.

  • @amir-ziaei
    @amir-ziaei 2 года назад

    Thanks Remix! These short videos are great and I love them!

  • @Safe2Sneeze
    @Safe2Sneeze 6 месяцев назад

    discovering these videos again today and they are awesome. 2 years old is a million years in web time but these are still amazing.

  • @emdagon
    @emdagon Год назад +1

    "Buttons are input fields" It's funny how stuff I learned 20 years ago (while reading html 4.0 spec) sounds like news now 😂 -- Awesome framework!

  • @alinsimion
    @alinsimion 2 года назад

    Mind blown! Great job guys!

  • @DEV_XO
    @DEV_XO 2 года назад

    Amazing series! Remix is just 🔥💚

  • @DEV_XO
    @DEV_XO 2 года назад +1

    Been watching this video with a smile on the face. This tells you all I guess!
    ♥💛💚💙🖤

  • @xxxpilot
    @xxxpilot 2 года назад +1

    "bop-bop-bop-bop-booop"... I will do it all the way from now. With Remix :D

  • @cagdasucar3932
    @cagdasucar3932 6 месяцев назад +1

    Remix is so much better than Next.js. Good job!

  • @tomaszgrabowski8766
    @tomaszgrabowski8766 8 месяцев назад +1

    I ❤ Remix! I was so tired of Next and now I like to do a web dev once again!

  • @gijsroge
    @gijsroge 2 года назад +11

    Awesome videos, thanks!
    Maybe a video that shows how you would approach reusable components, used on many routes that fetch and post data?

  • @dmbarry86
    @dmbarry86 2 года назад

    These singles are great.

  • @dagoacarralero5080
    @dagoacarralero5080 Год назад

    Papapapa this was fun & enlighten. What such a good tech, now I see why the REMIX

  • @willsmith4140
    @willsmith4140 Год назад +7

    I get that it's cool in theory to use all this native functionality, but at the end of the day having this giant form with multiple hidden inputs is way less readable and maintainable to me, compared to an "onClick"

  • @fabischkamau
    @fabischkamau 2 года назад

    Aaah thanks i run into that problem sometime ago 🤦 but now i now i know how to handle it. Thanks you☺️🥳

  • @daoodqurashi4758
    @daoodqurashi4758 2 года назад +1

    Yeahh rayan keep it comming

  • @ronderksen
    @ronderksen 2 года назад +5

    The “bop bop bop bop”, followed by a little chuckle at 8:44 really reminded me of Bob Ross. Which is awesome.
    On a more serious node: you could use the form method to distinguish different forms, right? And the button value to differentiate further when needed?

    • @Remix-Run
      @Remix-Run  2 года назад +3

      It's all HTML, so yes and yes. Do it however you like.

  • @albiceleste101
    @albiceleste101 2 года назад

    Thank you so much!

  • @DenysSlipko
    @DenysSlipko 8 месяцев назад

    Thanks a lot!

  • @pablen808
    @pablen808 2 года назад

    Yep. I did enjoy it.

  • @jacobharris3929
    @jacobharris3929 Год назад

    almost 10 years of webdev and i never thought to use a button as a form input with a value. wild stuff

  • @nightshade427
    @nightshade427 2 года назад

    Reminds me of aspnet postback model and client side auto update using updatepanel of the early 2000s. I dig it, it's a mix of old and new.

  • @Sm123bg
    @Sm123bg 2 года назад

    Hello. If I had a form that added a like to a blog post or something would you recommend just removing the default submit button styling so only a font awesome icon is shown?

  • @mjg_____
    @mjg_____ 2 года назад

    everything old is new again and I mean that in the best possible way 😅 side note, having educators create a framework makes learning it soooooo much easier.

  • @royrevelt5698
    @royrevelt5698 2 года назад

    Bravo! Give it a year and The Industry will wake up and start using Remix. If I may ask an unrelated question - Mr. Florence, which keyboard (and mouse) are you using in this recording? It's not mechanical, is it?

  • @fev4
    @fev4 2 года назад

    damnn! this is nice

  • @simonswiss
    @simonswiss 2 года назад

    You are correct - I never implement an abort fetch for rapid clicking 😅

  • @juraev0056
    @juraev0056 2 года назад

    Hi, is _action with value being added to FormData with ? Because Chrome does not seem to include button by default if I just call new FormData(form) in fetch.

  • @jannekanerva9484
    @jannekanerva9484 Год назад

    What if I also wanted to create an API for the same actions (like e.g. the delete action) and provide it to my customers? Should I separate that into a different route (so duplicate it) or how is that meant to be done in remix universe?

  • @tobrie1976
    @tobrie1976 2 года назад

    If you have the `Form` post to a different path via `action="/somewhereelse"`, like described at 00:01:30, ...
    1. how to prevent the browser from navigating there, and
    2. how to get potential server-validation errors back to render them below the input fields?

  • @farrukhazad
    @farrukhazad 2 года назад

    nice work dear friend , i like , nice share , stay connected

  • @trashAndNoStar
    @trashAndNoStar 2 года назад

    Is there a sample code discussed here on a gist/repo?

  • @SeanLazer
    @SeanLazer 2 года назад +3

    Maybe more of an architecture question but how would you scale this out to a route that has potentially dozens of mutations? For example a dashboard. I've gotten really accustomed to building reusable components that do their own data management, ie you embed the Users, Orders, and Products widgets on the dashboard page and they take care of their own data needs. How would you handle something like that in Remix without having super bloated loader and action functions?

    • @frontendtony
      @frontendtony 2 года назад

      I've not tried Remix yet, but isn't this a good candidate for nested routes?
      I'm trying to imagine a scenario where this would be possible where the mutations aren't in a list

    • @SeanLazer
      @SeanLazer 2 года назад

      @@frontendtony that's what I was wondering, maybe the idea of like portable or embeddable routes. I just remember the rails days of a dashboard#index action where you're loading like 10 separate pieces of data in one controller action.

  • @amsterdamtinus8456
    @amsterdamtinus8456 Год назад

    As one of these old developers I would add an hidden input for the action as well, like in the olden days :)

  • @user-jn3yi8rm1p
    @user-jn3yi8rm1p 2 месяца назад

    which tool do you use for disalbe/enable javascript on developer mode?

  • @frozen_tortus
    @frozen_tortus 2 года назад

    2:47 While I like this approach, React is throwing an error for this approach since 'onClick' handler is missing. Is it possible to suppress that error?
    EDIT:
    Use defaultValue :)

  • @tshddx
    @tshddx 2 года назад +7

    I love the "use real forms" stuff, it's great to be able to dust off my PHP and Django web dev experience from 15 years ago! Has the Remix team been thinking about how to model forms in such a way that we can get TypeScript coverage between frontend (default export) and backend (loader and action exports)? Having these all in the same route module file is already such a neat developer experience, it would be even cooler to have the tooling help a little more with this stuff! I've been playing around with different ways of doing this in Remix but haven't found anything that fits naturally with the inherently untyped nature of the web APIs (e.g. FormData and input name and value attrs).

    • @tomrowe2181
      @tomrowe2181 2 года назад +1

      I personally tie the form typing with validation using Zod.
      Someone recently created remix-validated-form as well to add onto zod or yup and just make using forms a little nicer.

  • @OberfeldwebelPfeffer
    @OberfeldwebelPfeffer Год назад +1

    Why don't you use the method="delete" in the form? That way you wouldn't need to define the "_action" name on the button.

  • @oussou_lessou
    @oussou_lessou Год назад

    Holly Button !!! 😯

  • @mogadanez
    @mogadanez 3 месяца назад

    can we use just method="DELETE"?

  • @RustanJhi
    @RustanJhi 2 года назад

    Really enjoy it. "bop bop bop bop", makes me laugh.

  • @dmsnm
    @dmsnm 2 года назад +2

    Great solution. Can we get one where inputs are dependent on another input's value?
    Like when sub category select options are dependent upon category select value.

    • @tomrowe2181
      @tomrowe2181 2 года назад +1

      This is a good use case for useFetcher
      OnChange of the first select, you can trigger a fetcher submission to retrieve the options for the second dropdown and populate it.
      Or for a normal react solution simply send all options down on first page load, and useState to track which set to show

  • @edwarddelgado9654
    @edwarddelgado9654 Год назад

    I'm old school hidden but data-* on the button might also work for the id.

  • @ZachCurtis
    @ZachCurtis 8 месяцев назад

    The sound effects while deleting make this video! 🤣

  • @FzsHotDogInDonut
    @FzsHotDogInDonut 6 месяцев назад

    Any RTE for remix js????

  • @dmytroulianov8743
    @dmytroulianov8743 2 года назад

    just curious how it would work if I wanted to delete a few users simultaneously like clicking five times on different names with slow connection, I guess it will do the job for my last click but not for all of them right? btw really like remix and your videos

    • @dmytroulianov8743
      @dmytroulianov8743 2 года назад

      nice video on concurrent mutations, thanks!

    • @alexmachin1785
      @alexmachin1785 2 года назад

      Yeah that's what I've been thinking, like if you have a table and select multiple users how can you handle that ? I bet you can it's just a matter of understanding how.

  • @DaCurse0
    @DaCurse0 2 года назад +1

    5:25 ah yes, classic DOM clobbering 😁

  • @stiforr8714
    @stiforr8714 Год назад

    A replacement for _action i've been using is "intent"

  • @danwilloughby2088
    @danwilloughby2088 2 года назад +3

    7:09 bop bop bop bop bop bop buh bup 🤣. Can that please be the official name for that concept?

    • @sotr-archives150
      @sotr-archives150 Год назад

      Throtting or debounce, there is a lodash utility for this as well.

  • @vrfjwehs29
    @vrfjwehs29 6 месяцев назад

    Ohh thats how that works

  • @DanKreiger
    @DanKreiger Год назад

    I don't do much, but I always used to abort unnecessary requests

  • @barmannphoto
    @barmannphoto 8 месяцев назад

    A user could change the values of the hidden fields before submitting. It seems like there should be a more secure way of doing this.

    • @TheDrokon
      @TheDrokon 7 месяцев назад

      So the user is going to hack themselves? This is silly

  • @mrala
    @mrala 2 года назад

    8:46 type `ej` for enabling and `dj` for disabling javascript

  • @JLarky
    @JLarky 2 года назад

    I wish action was passing $REQUEST