Data Fetching using React Suspense and Error Boundary - React Data Fetching Patterns.

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

КОМЕНТАРІ • 52

  • @regilearn2138
    @regilearn2138 2 місяці тому +2

    this is totally different side of how others showcase Suspense and Error Boundary. Appreciate it.

  • @Prince-yz1tc
    @Prince-yz1tc 7 місяців тому +8

    Just a suggestion: You could use browser's inbuilt feature network throttling where you can intentionally slow down the request to show loading states to user.

  • @reyoreno7639
    @reyoreno7639 3 місяці тому +1

    Thanks for your efforts! I've just got a few notes to mention:
    Your example of "Fetch then Render" is actually the exact same as "Fetch on Render". All you did was move the code from inside the function into separate functions, but you still run the code from inside the component and they work exactly the same as if they were written inside. All you did was just some refactoring that has no effect.
    Also, the code you made in "Fetch then Render" does not solve the "network waterfall" issue. The `fetchAllData()` function will fetch sequentially due to the use of `await`, meaning that `await fetchTime()` will not start until `await fetchCountries()` finishes and returns data.

  • @jaybarls
    @jaybarls Місяць тому

    This is fantastically clear, thankyou - feels like the missing piece when trying to get to grips with data fetching in React. Often tutorials just show you a method but as you pick up different methods/approaches, it's never really clear why a particular approach or technology is used.
    For example, I have been using React Router's loaders, which if I understand correctly would more truly into the 'fetch then render' pattern than even the example you gave (which technically renders/mounts first, provides a loading state, and then re-renders with the fetched data). But then it's recommended that you supplement this with something like Suspense to handle loading states. Before this video though, it was really unclear to me as to why you even needed a Suspense fallback component when you could just conditionally render using a loading state within the same component - but now I can see how using a more declarative approach is more useful than conditional rendering.
    Also keen to see how this will be good preparation for using Next.js!

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

    Generally i try to avoid this type of lengthy videos, as it’s tough to keep concentration for a long time. But the way you have explained the topic my concentration never wavered not even for a single moment. Thanks a lot sir..

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

      Thanks a lot. I am glad that you found it helpful.

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

    Thank you for creating such a clear, comprehensive video.

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

    Love from Bangladesh Sir.
    Those concepts are really underrated. Thanks for teaching us in a charismatic way.
    Can't wait for the next.js series.

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

      Thanks a lot. First video is coming on Sunday.

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

      @@tapasadhikary That's Great Sir. All the best ❤️🇧🇩

  • @gajanankanekar9118
    @gajanankanekar9118 7 місяців тому +1

    Excellent teaching, Sir.Thanks.

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

    Excellent video, great teaching and personality. Hope you continue growing this channel, subscribed!

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

      Thanks a lot… for the wish. I hope it happens soon 😀

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

    Good Understanding, Love from Bangladesh.

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

    what a great explanation :) understood everything in one go. Thank You sir

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

    Just WOW! sir @tapas. Suspense makes things easier.

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

      Yes a lot… and as you know it now, you will learn App Router even faster.

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

    Highly informative and valuable content. 🔥

  • @imranjms
    @imranjms 10 місяців тому +1

    kalker video(sumit bhai + ali bhai r apnar ) ta joss chilo dadabhaii..

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

      Thank you for joining vai… more to come

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

      just enrolled in the course dda..
      See you in the course @@tapasadhikary

  • @MD.IKRAMULHOQUE-c3o
    @MD.IKRAMULHOQUE-c3o 9 місяців тому +1

    Which one is more effective, using react query or fetch while render process? @tapas da

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

      More than rendering, it depends on your application use cases. If your application is small, simple, do not require a lot of server-side controls like caching etc.. go with fetch API, always.
      When you need features like caching, automatic refetching, etc.. prefer the react query for a better control.

  • @Sagarclips
    @Sagarclips 3 місяці тому

    nailed it Tapas! keep it up

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

    good video 🎉 add a quantity of content in this platform thanks

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

    amazing presentation.

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

    Thank you for the amazing explanation!

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

    this was a nice video please sir make some more videos of industry standard development techniques

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

      Thank Rahul ❤️. Do you mean coding standards? Btw, this video itself teaches 3 coding patterns and which one good for why… a frequently asked interview question 👍

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

      @@tapasadhikary yes coding standards as well as clean structured code

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

      @Rahul_Kalasuva sure.

  • @aburaihan-py4vi
    @aburaihan-py4vi Рік тому +1

    Excellent!!!!!

  • @yabuking84
    @yabuking84 8 місяців тому +1

    8:16 what do you mean until useEffect() is done its not going to render at all? Nothing was halted, the component is actually rendering, that's why you can see the loading component because it rendered that.

    • @tapasadhikary
      @tapasadhikary  8 місяців тому +1

      UseEffect is asynchronous so it doesn’t block anything… what I meant there was the data that the effect brings for the component to render is on wait until the effect is done. It was to put in the contrary to the next strategy where we fetched things beforehand.
      Sorry for the confusion and may be not using the right term there 😀. Also, thanks a lot for your comment 👍

    • @yabuking84
      @yabuking84 8 місяців тому +1

      @@tapasadhikary thanks for clearing it up sir, i was a bit confused, react newbie here. Been only doing Vue but recently been doing React.

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

    Is React Suspense possible with Firebase?

  • @ayushshende4290
    @ayushshende4290 3 місяці тому

    Okay two questions: Where does libraries like react-query and swr fit (in which approach) ? Secondly, I came across one other approach where the react-router's loader api is used in conjunction with react-query. loader api is used to pre-fetch and react-query for caching. What do you have to say about this approach?

  • @sureshlahane3017
    @sureshlahane3017 6 місяців тому

    where I cant use Error Boundary, means the limit of Error Boundary🙃