The Remix.run Data Hook Secrets You Need to Know!

Поділитися
Вставка
  • Опубліковано 27 вер 2024

КОМЕНТАРІ • 8

  • @Adityacode
    @Adityacode 3 дні тому +2

    The fetcher. data is not bound to the components life cycle, which is very annoying sometimes. For example, when i have a dialog with a form and i want to show a toast to the user using the fetcher. data, but when the user closes then reopens the dialog then the toast is shown again. This might seem like a small problem but it hampers both the ux and the dx and i had to use tanstack query's useMutation for it. I also tried a hacky thing by calling a resource route action that returns null to reset the fetcher. data. Is there any elegant solution for this problem?

    • @alemtuzlak
      @alemtuzlak  3 дні тому

      Elegant no, but you could create a custom fetcher for this with useState where you have a boolean flag that is reset on a shown notification or something like that, obviously it's a bit hard to say concretely how to handle it without the code but thats the first thing that comes to mind

    • @khanahmad452
      @khanahmad452 2 дні тому

      Will remix-toast solve this problem?

    • @alemtuzlak
      @alemtuzlak  2 дні тому

      @@khanahmad452 it could, depending on the code he has 😅

  • @WengKittTangKLN
    @WengKittTangKLN 3 дні тому

    I learned a lot of Remix from you. Please keep posting !

    • @alemtuzlak
      @alemtuzlak  3 дні тому

      Will do, thank you for watching!

  • @KiiraKoko
    @KiiraKoko 4 дні тому

    Awesome!