React Streaming In Depth: NextJS! Remix! DIY!

Поділитися
Вставка
  • Опубліковано 19 лип 2024
  • Code: github.com/jherr/react-streaming
    Original React team example code: codesandbox.io/s/kind-sammet-...
    👉 Practical Module Federation Book: module-federation.myshopify.c...
    👉 No BS TS (The Book): no-bs-ts.myshopify.com/
    👉 I'm a host on the React Round-Up podcast: devchat.tv/podcasts/react-rou...
    👉 Don't forget to subscribe to this channel for more updates: bit.ly/2E7drfJ
    👉 Discord server signup: / discord
    👉 VS Code theme and font? Night Wolf [black] and JETBrains Mono
    0:00 Introduction
    1:05 Our Example Project
    2:43 NextJS 13 Setup
    4:26 Non-Streaming Render
    6:01 Streaming Render
    14:00 Remix Setup
    18:22 Streaming Render
    23:14 DIY Project Setup
    27:06 Adding Client JS
    34:06 Streaming Render
    37:55 The Big Payoff
    41:51 Adding Interactivity
    47:24 Outroduction
    #react #react18 #nextjs13 #nextjs #remix
  • Наука та технологія

КОМЕНТАРІ • 133

  • @solidcake2998
    @solidcake2998 Рік тому +57

    Jack, I cannot stress enough how big of an absolute gem you are to this community!

  • @CentMSN
    @CentMSN Рік тому +18

    I'm a huge fan of your videos. Far better content than most of paid courses!

  • @cambodianjesuss
    @cambodianjesuss Рік тому +9

    Your channel is the best! Thank you so much for being a huge resource in the community! Definitely helped me out a lot with understanding some topics with react

  • @r-i-ch
    @r-i-ch Рік тому +10

    As always, great higher-level content well explained. Thank you Jack!

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

    Thanks Jack.
    Really love this video of walking through how nextjs or remix or any ssr framework does to us!!

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

    I was following your videos for a long time, appreciate what you are doing to the community! keep it up!

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

    best video I've seen comparing these features and showing how actually things work wth simple example, congrats

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

    This is a gem of video
    For anyone who thought streaming is this complicated technology
    it just goes on to show that its is in essence a very simple thing that's going on
    Thanks a ton for this Jack !!!!

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

    Brilliant video Jack, really explained a lot about SSR to me. The pace of this video was spot on - fast enough to cover a lot, but enough time taken to follow what's going on.

  • @greendsnow
    @greendsnow Рік тому +4

    Because of this, I was so frustrated with the Framer-Motion today. Just because of the animations were I going to load everything on the client? It was outrageous.
    Little did I know!

  • @1235niki
    @1235niki Рік тому +1

    Thanks for making this demo and the detailed explanation on this Jack

  • @shane-porter
    @shane-porter Рік тому +2

    Hi Jack - I’m a new subscriber, having watched a video of yours for the first time a week or so ago. Thank you for making such great content, I hope you have a great Christmas, and a fantastic 2023!

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

      Thank you. To you and yours as well.

  • @ogreeni
    @ogreeni Рік тому +4

    I was waiting for this topic! I guess I know what I'll be watching this afternoon.

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

    The best framework that handles hydration so far is Qwik.js. They even don't call it rehydration, they name it resumability. In order for react to adopt this, it will need a rewrite for its core (Fiber right?) and then we would get rid of the sending the state of the app from the backend to bootstrap the frontend app.
    I am sure that react core team have the best minds to find a good solution, but until they do we will need to live with the window.__data trick (which is not that dramatic IMHO)
    moving to qwik at this stage might be a big ask to do, but what I am seeing with qwik is very compelling to migrate to it to solve the rehydration issue.
    I am happy to see where those two great libraries (react and qwik) will offer to the web scene in the near future. A really healthy competition.
    And in closing note, thank you Jack for bringing in those amazing topics, and doing the effort to back it up with a set of a very awesome videos and github repos to clone the code and play with it! keep it up, sir!

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

    Jack, you are a rock star man !!! This is mind blowing stuff !!! Still I can't wrap my head around the DIY approach ! Going to do hands on so it will all make sense to me, Thanks for the awesomeness !

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

    Really useful video, thanks so much for putting it together

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

    Can’t wait to watch this one! Thanks Jack! 🙌

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

    That squirrel in your backyard in the Outroduction chapter :D
    But great video, thanks a lot!

  • @zakir.nuriiev
    @zakir.nuriiev Рік тому +1

    Cool! Thanks a lot for the explanation!

  • @EddyVinck
    @EddyVinck Рік тому +3

    50 minutes! Absolute legend!

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

    great stuff, thank you, happy new year, ☕

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

    insanely good video, love it. t hanks jack!

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

    That was a lot of information there. Really awesome. I must've been a good boy to receive this present from Santa 😛
    Thank you very much and MERRY CHRISTMAS

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

    This was truly awesome!

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

    Love the content Jack
    I'm new to full stack with React n express but know them separately
    It'd be great if you could post a video on how to setup an app with express and react like you did in this DIY version as I'd really like to understand the barebones

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

    Thank you, it was easy to follow and learn 🙂

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

    Nice one! I learned a ton today.

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

    Mr react Mentor in action! thanks man, highly appreciated

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

    DYI is great, thank you!

  • @eleah2665
    @eleah2665 Рік тому +5

    Thanks as always. I'm interested in Remix if you want to do more on that.

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

      Same here, liking remix a bit more tha next js

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

      Try sveltekit bro you will like it

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

    Excellent video Jack. Thanks very much for doing this. One question. I am curious to know how you have that stylistic terminal prompt. Looks very good. Does it even track git status etc?

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

    Mind blowing... Jack rocks 🤙

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

    awesome video thanks

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

    Thanks Jack!

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

    Amazing!

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

    thx for video, it was really usefull. Now I have reasons to drop nextjs in favor of custom ssr

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

      Or not... If you're not joking, then I would advise against that.

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

    Thank you again

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

    Hey Jack can't we just JSON stringify the comments and parse them later instead of using the defer keyword
    Great vid as always, such a gem in this space and Happy New Year

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

      Because you'd block on the request to get the data so that you could JSON'ify it.
      Thanks!

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

    rakkas is a small but up and coming reactr meta framework that uses vite and also has it's own implementation of streaming components and server only useQuery replica without server side components

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

    Holy mama sounds like NextJS 13 made it really easy to use React Server Components + SSR as compared to the DIY way of doing it lol

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

    Great video, thanks a ton!
    Couldn't you just skip hydration if window.__data is defined since the server already rendered everything?

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

      Nope. Because the client is going to render all those components again and it needs the data to do that. This is the "Hydration problem" that has plagued React since the advent of SSR and is the reason why we now have React Server Components which are trying to address this issue, as well as new frameworks like Qwik which are trying a different approach to this problem.

  • @mat_0684
    @mat_0684 12 днів тому

    Thanks for the great content.
    Following a Nextjs 12 /React 17 upgrade to nextjs13/react18, is it possible to use Streaming SSR on a component used in a page from the /pages folder?

    • @jherr
      @jherr  12 днів тому +1

      No. That’s an App Router feature.

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

    Hi Jack, Thanks for the geat content
    Can you please do a video about Qwik.js

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

    Hey all, Can you please explain the difference between ./Loading.tsx vs Suspense API?

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

    What do you think of ChatGPT ? And how does it compare to github copilot?

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

    How would I know whether a file is a client component or not without opening it?

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

    7:41 maybe I need to just continue watching but will there ever be a more prod ready way to deal with this? Feels a bit hacky

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

    Hi Jack, nice work so far. I learn a lot from you. BTW, I'm learning Remix and I see you are using "remix@deferred". I tried googling but I did not see any documents talk about Remix deferred and React 18 streaming SSR with remix. Could you share to us the document or any article talk about it. Waiting for your reply :D

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

      This branch was introduced to me by Jacob ebey (a member of the remix team) as the soon to be released alternative to the nextjs solution to streaming.

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

      @@jherr Many thanks ^^ I'm looking to the next release of Remix. So nice

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

    Hi Jack, where do learn this kind of stuff from? Is it just experience and digging down in the documentation?

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

      I read the docs. And in the case of Remix I talk to the core team.

  • @berkaycirak
    @berkaycirak 4 місяці тому

    Does the html parser on the browser wait for the stream? I mean, 39:10, we first rendered some part of the html and our browser paints it, then new html is come with new script and our browser will re-paint and reflow again from scratch?

    • @jherr
      @jherr  4 місяці тому

      AFAIK the HTML in the stream is there only for bots. The client isn't going to execute that. It's going to injects the RSC stream into the VDOM and then render that on the client.

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

    I can see that you have Obsidian open also. You mentioned it on twitter hope you like it!! Anyway nice video thanks

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

      Yeah, it's good. The remote vault setup is a little klunky. But it works now. Better than Quiver.

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

      @@jherr yes I struggled a little bit at the beginning but once you have everything set up it’s impossible to change!!!

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

    How did you change your Mac OS app switch animation?

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

      That's Stage Manager.

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

    sir ,
    since I have discovered your channel, it helps me grow a lot on my current job because I trully understand how things trully works.
    I have niche website I have built with many blogs, tutorials, forum , and many others service completely built with ReactJs and springboot backend.
    now I want to upgrade the site to NextJs for SEO purposes because of the advice I got from many experienced engineers advice me to upgrade the frontend to nextJs for better SEO.
    1) is it even necessary to upgrade the site to nextJs for SEO purposes, if so how do you approach upgrading site to nextJs from ReactJs ?
    2) is it anyway we could have a better SEO with ReactJs ?
    I would love to hear from you sir
    thanks

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

      SEO has nothing to do with SSR. It comes down to the content on the page, the title and the meta tagging. Google has been able to run the JS on CSR sites for years. So I would start by addressing your SEO issues first, and then see if, for performance reasons, you might want to go to SSR or SSG.

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

      @@jherr thanks
      I also heard from others that google bot can’t index pages from a Reactjs easily since the JavaScript code are still loading and google bot can’t wait therefore , SEO is bad if site is built with ReactJs.
      This is what I heard.
      I am still earlier on my career and I heard here and there different things that obviously confused me at some point .
      Thanks

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

      @@gabrielfono844 First off, NextJS is built on top of ReactJS. So if you want to stay with React, then your choices are SSR with NextJS, CSR with Create React App or Vite, or SSG with NextJS or Gatsby. (There are other choices, but those are the primary ones.)
      If "ReactJS is bad for SEO" then all of those options are bad, since they all run ReactJS. In fact, SSR is worse than most because it runs the React app TWICE, once on the server and then again on the client.
      I'm not an SSR hater, I'm using it right now, but it's because I want to talk to the backend from the server behind the firewall and not from the client.
      The whole SSR/SEO thing is an old wives tale that has been around for decades now and everyone just takes it as gospel without actually thinking about it. Suffice to say the "NextJS + SSR = SEO because NextJS is not ReactJS" equation makes no sense.

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

      @@jherr thanks
      Will share this comment with my colleagues
      Thanks a lot

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

    7:48 why are we not seeing the 2 second delay before you introduced Suspense? is it because response is being served from cache?

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

      I think what it actually was, was Chrome keeping the current page visible during the refresh until the page fetch completed.
      IRL, what actually happened was what happens so often. I hit refresh, got the two seconds, started talking about it, screwed up what I was going to say, and and went back to do it again, only to get this behavior where it was taking the time but it wasn't visible and I kept on going with it.
      Try it out for yourself, if you block for two seconds in the component you'll block the server for two seconds.

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

    hi jack, i looking for vscode extension that can show node js version, what is it called?

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

    Jack, Did you try preact's signals? What are your thoughts on them? (They have signals for react)

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

      Great idea, but I found the implementation a bit kludgy. As I recall it was only for replacement of atomic values as innerText or props. Which is nowhere near as powerful as Solid. I think if you want signals you should do something like Solid and get proper signals.

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

      @@jherr But if I don't(/can't) use Solid? Is it good enough?

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

      @@oskrm My honest opinion? No. I love preact and I love what that team has done for the community. But the signals stuff feels like a hack. And its limitations make it borderline unusable.

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

      @@jherr Okay, thanks for your reply tho!

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

      @@jherr Another question, how would you handle i18n in next13?

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

    If you control/trust the source then dangerouslySetInnerHTML is not so dangerous.
    Just never use it for user-generated content or have a vetted input sanitizer.

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

    In my case , react suspense ( Loading ....) not working on safari browser . Works fine with Firefox.

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

      Interesting... I wonder if Safari just isn't keeping the connection open. That's a troubling find though.

  • @tedogirma
    @tedogirma 8 місяців тому

    that's cool 👍👍👍👍 Hydration is the problem on remix

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

      Hydration is a problem on all the non-Qwik isomorphic frameworks.

    • @tedogirma
      @tedogirma 8 місяців тому

      @@jherr so what will happen if hydration issue happens on production?

    • @jherr
      @jherr  8 місяців тому

      @@tedogirma Flicker, poor performance, and possible SEO issues.

    • @tedogirma
      @tedogirma 8 місяців тому

      🙏🙏🙏 Best teacher ever ❤️❤️ Thanks again

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

    32:53 Suddenly you turn into a rapper. 🥳

  • @Dev-Siri
    @Dev-Siri Рік тому

    Is it possible to stream in & append more data in Next.js?
    Like if in the query params the value of page is 1
    We get the initial data,
    and then as the user scrolls down and the query params increase
    new content streams in and adds to the existing data shown on the page.
    Its the same as fetching more from the client and setting it as state, but instead a server-side equivalent?

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

      I think you'd have to handle streaming yourself to handle that. What streaming is designed for is for loading an initial page and then streaming requests, that are started at the beginning of the render, later to the page. What you are talking about is an optional interaction later. Some users will scroll, some users won't, and we don't know who is going to be doing any scrolling on the server side at the time of the render.

    • @Dev-Siri
      @Dev-Siri Рік тому

      ​@@jherr
      oh ok. I was actually looking for a simple server-side solution because my current implementation causes some server-components to be hydrated because they were being imported in a client-component. But I guess I have to look for some other way.

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

      @@Dev-Siri I don't think you should worry about RSCs too much. Certainly not so much that you bend over backwards to try and force stuff like this with streaming.

    • @Dev-Siri
      @Dev-Siri Рік тому

      ​@@jherr I actually didn't care about RSCs until they became a problem. When I tried to use something that should be rendered ones (it will cause hydration error) or a child of the RSC that uses something that changes every second (eg date/time). Those started causing hydration errors & I had to switch to client rendering for those. But this also made the app very slow with so many 'Loading...' texts & spinners. (sometimes even loading for as long as 3-4s). Which kinda felt unneccesary since it could be just rendered on the server. And I have actually figured out a solution myself now but it took a lot of work.

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

    I wish you would at least mention, that the same thing is possible with Gatsby.js 🙏🏻

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

    Is this possible in any of the other frameworks by any chance? Vue, Nuxt, Angular, Svelte?

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

      That's a great question. I honestly don't know. I'll take a look around at some point.

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

    Hi, having issues in Safari, Suspense is working great with Chrome, but Safari just waits for a fully loaded page.. Frustrating

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

      You need a larger page. Safari has a weird issue with streaming on small pages.

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

      @@jherr wierd, but thanks for the explanation! Really appreciate that. Nice content.

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

    this is the exact mid level engineering stuff I am always looking for

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

    hi do you have content on nextjs vs remix

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

      A few videos. Just do a search on NextJS, I do a lot on it.

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

    How to make apple icon inside in terminal like on the video?

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

      Oh my posh and oh my zsh on tabby with a nerdfont for the special characters like the apple

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

      @@jherr Thank you!

  • @thisweekinreact
    @thisweekinreact Рік тому +8

    Looks easier to use a framework than DIY 😆

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

      Very definitely.

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

      No it's great to work in react

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

      That's why frameworks are created, to facilitate the developing process, so that developers can spent more time on things that matters.

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

      Knowing how things work under the hood make you more efficient

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

    OMG fellow arc mate. How is it?

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

      I love it. It's f'ing amazing.

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

    What is that Arc browser?

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

      Pure awesome :) really enjoying it.

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

      @@jherr I tried to go to their site but looks like it's not out yet, they put me on waiting list lol

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

      @@reactivenyc DM me on twitter I’ll send you an invite.

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

      @@jherr deleted my Twitter :(

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

      @@reactivenyc ok use the discord server then. :)

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

    Hmmmmmmm...

  • @infisspablo8602
    @infisspablo8602 Рік тому +3

    First comment gang B)

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

    audio was kind of bad, a lot of lisp/ess sounds

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

      Ok, thanks for the feedback on that. It's a work in progress.

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

    I am sorry. Who's teaching me here? Jack or Copilot?

    • @jherr
      @jherr  Рік тому +5

      Me. Thanks. It was me who spent hours doing the research and working through all the little gotchas on each platform. Me who spent hours recording the video. Me who spent hours editing the video and putting it all together.

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

      @@jherr haha good one. I can see your effort in your video. Thanks mate for all the videos you do. Learned a lot. Especially bs ts 😃

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

    "That is the hackiest thing ever! i am never gonna watch your channel again!" (proceeds to unsubscribe) :P

  • @abinashshasini577
    @abinashshasini577 Рік тому +4

    Sir please create a complete code work through of react SSR we need to understand a little bit more like write everything from scratch
    BTW great work 🫡