Out-of-order streaming in React

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 พ.ย. 2024

ความคิดเห็น • 68

  • @28bits20
    @28bits20 8 หลายเดือนก่อน +1

    I love your approach to teaching where you progressively show more complexity with each example. I wish all teachers were this thoughtful.

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Wow, thank you!

  • @CliffordFajardo
    @CliffordFajardo 8 หลายเดือนก่อน +6

    Great video!; I love how it's focused on fundamental principles & APIs & gradually builds up, all while keeping the code & examples simple
    I think a lot of us are tired of the super high level framework videos, so seeing "under the hood" is refreshing!

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน +1

      Awesome and thank you! I've been toying around with making some videos that show off how a framework wires together some of the RSC APIs. I think that'll make for a nice under the hood video.

  • @maro7057
    @maro7057 8 หลายเดือนก่อน +3

    I can easily understand your explanation even though I am not a native English speaker. I really appreciate for your video.

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน +1

      That's so great to hear! Thank you!

  • @madatbay
    @madatbay 8 หลายเดือนก่อน +5

    Your content is soo clean, high quality. I enjoy so much especially when I watch your content. Alsa Sams, hope we’ll see more from you

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Thank you so much!

  • @matej2714
    @matej2714 8 หลายเดือนก่อน

    That was so clean!! Beautiful delivery and nice example 🎉

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Thank you!

  • @codingintelugu8820
    @codingintelugu8820 8 หลายเดือนก่อน

    Awesone Ryan, Now we can wire all the suspense & streaming stuff

  • @ohlordmiker
    @ohlordmiker 8 หลายเดือนก่อน +3

    Killing it lately with all of the recent vids Ryan! You've become must-watch for me. Amazing explanations and examples.

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Wow that's great to hear! Thank you!

  • @divyeshio
    @divyeshio 8 หลายเดือนก่อน

    💯Wow the explanation was so crisp and clear to the point! You've got a new sub!

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Thanks and welcome!

  • @edgarasben
    @edgarasben 9 หลายเดือนก่อน +2

    Thanks Ryan for explaining how this works behind scenes! 🙏

    • @RyanToronto
      @RyanToronto  9 หลายเดือนก่อน +1

      Thanks Edgaras!

  • @darthvader4899
    @darthvader4899 8 หลายเดือนก่อน

    Absolutely underrated

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Thank you!

  • @Luisllaboj19
    @Luisllaboj19 8 หลายเดือนก่อน

    I really appreciate this content about the features that come with app router, still can't understand when and where to use server actions vs route handlers, hopefully you soon find time to share the best practices. Again, thank you for this content!

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Thank you! It's a tricky question to answer, but I would say if you're using Next.js App Router then you should mostly be using server actions.

  • @javLG
    @javLG 8 หลายเดือนก่อน

    Really enjoyed the video and content, keep the great work Ryan!

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Glad to hear it! Thank you!

  • @AbdurRahim-eu3zr
    @AbdurRahim-eu3zr 8 หลายเดือนก่อน

    Literally Best Explanation 🙌

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Thank you!

  • @jordancutler7552
    @jordancutler7552 8 หลายเดือนก่อน +1

    Fantastic as always, Ryan. Really appreciate the content you are putting out. Very few I learn from to the level of depth that you put out

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Thanks Jordan :)

  • @incarnateTheGreat
    @incarnateTheGreat 8 หลายเดือนก่อน

    I laughed in delight at the last example. Hahaha. This was great! Thanks for sharing!

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน +1

      Ha, me too! I had so much fun putting that example together.

    • @incarnateTheGreat
      @incarnateTheGreat 8 หลายเดือนก่อน

      @@RyanToronto watching your videos makes me wanna get in on the React 19 experimental stuff.

  • @toomanyarguments
    @toomanyarguments 9 หลายเดือนก่อน

    Hey Toronto, I really appreciate for your efforts. They're absolutely helpful to get better understanding how everything works.

  • @jagadeeshgade6309
    @jagadeeshgade6309 8 หลายเดือนก่อน

    Great explanation

  • @akuoko_konadu
    @akuoko_konadu 8 หลายเดือนก่อน

    Thanks a lot, this is so cool, I recently watched Lee's video on streaming data, and this made me understand it really well, keep the videos comming

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      That's awesome! Glad it helped!

  • @spiritz0r317
    @spiritz0r317 8 หลายเดือนก่อน

    Great video Ryan. I love how you always take the time to explain the fundamentals before diving into the actual topic.
    One thing that I wish was talked about more would be how using Suspense and loading.tsx impacts SEO because now you're relying on the crawler executing Javascript to get the full contents of the page, even though it's streamed as one request from the server.
    Keep up the great work! You and Sam are killing it!

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Thank you! And great point on SEO/crawlers! My understanding is that Google is able to read the DOM, so it can "see" all the client side JavaScript that runs. However, other bots still need HTML strings.
      Beyond that I don't know how to best serve up React's HTML for search crawlers. Are you running any sort of content / indexable site with RSC? Any advice?

    • @spiritz0r317
      @spiritz0r317 8 หลายเดือนก่อน +1

      @@RyanToronto My understanding is that the position in the DOM of your content is relevant to crawlers. For example, if your content is right after the H1 of your article Google will understand that it is relevant to the title. If it’s at the footer of your page there is a good chance Google will discard it as irrelevant, or even worse, as keyword stuffing.
      I’m not running a SEO optimized page right now running on the app router. We were considering migrating our website to the app router but these questions had to be answered as SEO is very important for my business.
      We decided to hold off migration at the moment, but even if we were to do it, I would avoid using any suspense or loading anywhere, which is a shame because they do provide a better UX for the user.
      I wish there was a way to disable out of order rendering conditionally on the server so you could block rendering for crawlers and users with no JS but use it for other users.

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน +1

      @@spiritz0r317 Ya I can totally understand wanting to hold off on anything that "changes" your HTML if your business relies on search traffic. Don't poke the Google bear :)
      Conditionally controlling streaming sounds like an awesome idea. I'm not sure if that's possible in Next, but it could be worth exploring. I think I might try to make a video on this!
      Btw, TH-cam sometimes makes it impossible for me to see these comments. If you want to reach out on Twitter (twitter.com/ryantotweets) feel free to!

  • @Infinitepixels
    @Infinitepixels 9 หลายเดือนก่อน

    Thanks for sharing. Super helpful for a deeper understanding. I especiialy enjoyed the part where you started with the fundamentals of ReadableStream

    • @RyanToronto
      @RyanToronto  9 หลายเดือนก่อน

      That's awesome to hear!

  • @shakapaker
    @shakapaker 8 หลายเดือนก่อน

    wow nice explanation it's the best I watched on that topic, nice content

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Much appreciated! Thank you!

  • @susilthapa4367
    @susilthapa4367 9 หลายเดือนก่อน

    Great content! loved it, great way of teaching!
    Thank you so much!

    • @RyanToronto
      @RyanToronto  9 หลายเดือนก่อน

      Glad you liked it!

  • @haritssyah7434
    @haritssyah7434 8 หลายเดือนก่อน

    9:12 So beautiful

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Haha, yup! I had so much fun building that streaming grid.

  • @ashleyredman
    @ashleyredman 8 หลายเดือนก่อน

    Am I right in thinking that suspense is only available to async components, I.e just server components at the moment? For a client component, any pending ui would still need to be ‘baked’ into that client component itself self in some form, such as is loading from swr?

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน +1

      Great question! Suspense will work with client (non-async) components as well. If a client component throws a promise then it can be caught and handled by a parent Suspense boundary.
      However, if you're using a data fetching library like SWR then I think you're better off following what they recommend and sticking with isLoading.

  • @jimfilippou
    @jimfilippou 8 หลายเดือนก่อน

    Amazing! Just a question out of curiosity, will suspense affect cumulative layout shift? I suppose the loading skeleton of each component should be as close (meaning position and width/height) to the actual data as possible? Again I am not sure, just thinking out loud.

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน +1

      Great question! And yes you are right, CLS is something to watch out for when using Suspense. If you want to avoid layout shift then you need to make sure your Suspense fallbacks match your content... which can be tricky sometimes.

    • @jimfilippou
      @jimfilippou 8 หลายเดือนก่อน

      @@RyanToronto Thank you so much man, love your content!

  • @noabstruction
    @noabstruction 4 หลายเดือนก่อน

    You voice. Masallah ❤

  • @ikbo
    @ikbo หลายเดือนก่อน

    Very interesting. It is done through long lived http connection or websockets behind the scenes?

    • @RyanToronto
      @RyanToronto  หลายเดือนก่อน

      It's a single http connection. In fact, it's the same connection that renders the first html you see... so I guess its a bit like long polling. As soon as all suspense boundaries are resolved the connection closes.

  • @v1r47
    @v1r47 8 หลายเดือนก่อน

    Why does this not work on a barebone react-app created using npm create vite@latest? Is there something I am missing?

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน +1

      Oops, my apologies! This is a new feature in React that's only available when using React Server Components.

    • @v1r47
      @v1r47 7 หลายเดือนก่อน

      @@RyanToronto Thank you. I was scratching my head with this :D

  • @roodood
    @roodood หลายเดือนก่อน

    FYI you don't even need javascript, you can use webcomponents/slots to achieve the same thing. No client side JS needed.

    • @RyanToronto
      @RyanToronto  หลายเดือนก่อน

      Nice. The slot element looks very cool

  • @IPhonixI
    @IPhonixI 8 หลายเดือนก่อน

    Doesn't it affect SEO since the original page gets edited by Javascript ?

    • @IPhonixI
      @IPhonixI 8 หลายเดือนก่อน

      Ow you already talked about it with someone else on comments!. Thanks

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Yup great question! I think this is a topic that deserves another video. For Google bot it hopefully shouldn't hurt SEO, but for other crawlers you might not want to send a streaming response.

  • @hakuna_matata_hakuna
    @hakuna_matata_hakuna 8 หลายเดือนก่อน +1

    what's the difference betwee that and the old way of using react query and showinga loading component while it's fetching ? is SSR that is

    • @frontendonly
      @frontendonly 8 หลายเดือนก่อน

      Yes,it provides SSR rendered page but not blocking the UI and show the loader where react query do it in client side.

    • @RyanToronto
      @RyanToronto  8 หลายเดือนก่อน

      Yup, what @frontendonly said! You get all the data for the page in a single HTTP request, but that request isn't blocked and it can stream in updates as data becomes available.
      With client side data fetching you generally have to have the browser make separate HTTP requests to fetch JSON payloads from your backend.

  • @cristiansfetcu2099
    @cristiansfetcu2099 8 หลายเดือนก่อน

    Very curious how this works under the hood