Next.JS 13 Server and Client Components in 4 Minutes

Поделиться
HTML-код
  • Опубликовано: 25 янв 2025

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

  • @kristjanretter6851
    @kristjanretter6851 2 года назад +4

    Thanks, for this really easy-to-understand and straightforward explanation.

  • @mr.random8447
    @mr.random8447 Год назад +1

    Isn’t the sidebar interactive as well? Definitely uses onClick

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

      This is a good point, I believe that in this example the sidebar isn't actually interactive because the links in the sidebar will likely use the Next Link component. Although links can use onClick, in this example using for those sidebar links would make more sense.

  • @nemeziz_prime
    @nemeziz_prime Год назад +9

    Hi, great explanation! It'd be really appreciated if you could demonstrate the differences in user experience for both cases - without SSR components v/s with SSR components, because a real-life demo would help a lot in understanding the differences. Thank you for making such amazing content!

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

      I would like to see a video like this, too!

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

    This video inspired my "ah hah" moment. Now I get the bigger picture. Thanks!

  • @KyPhanQuoc-uv2nd
    @KyPhanQuoc-uv2nd Год назад

    Hi, I am also trying to understand concept of client components and server component but I have a one question. Even if I use "use client" mark at the top of the component, that component is also rendered on the server? Am I right. I mean, when I check the network tab I can also see that client component. Also, when I write a console.log outside of the useEffect and inside a component which has "use client" at the top, I can see that console.log both on the server and client. Does every component is pre-rendered on the server first even if there is a "use client" mark (Client Component) ?

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

      The way I understand it is that your console.log is still included in the pre-built and built files. A file is requested, it returns the needed resource but also includes to run your console.log..
      Either that or dev environment have different compilation which I assume you are on dev mode.

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

    Thanks, what is the difference between SSR and Server Component?

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

      Good question! This guy explains it better than I could in a YT comment, take a look: dev.to/nas5w/what-is-the-difference-between-server-side-rendering-ssr-and-react-server-components-5339

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

    Best explanation so far, thanks!

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

    Great video thank you. can you make video about "prop classname did not match"? I'm stuck using nextjs and material ui with this error.

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

    great explanation! thanks for the content!

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

      You are very welcome. Thanks for watching :)

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

    I'm confused about the example, the list (the one with the thumbnails) was tagged as server side, but what if those are a list that will change when the user put a keyword on the search input.

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

      Hey mb on late response, I see what you're saying. In that example the search bar is more of like Google search so it isn't going to change the thumbnails under it based off of text input. The search bar itself needs to save the text of the search, and also listen for when the user presses enter, these are both client side operations so that is why it is client side. Hopefully this helps.

    • @arjuns.3752
      @arjuns.3752 Год назад

      ​@@CooperCodeshi I have a page with multiple posts. I want to filter filter posts and fetch new posts based on the user's wish. Should I fetch in client component or server component. I also want to fetch and append more posts as the user scrolls down

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

    Amazing explanation, thank you so much!

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

    Great simple overview. Thank you!

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

    Great video man!

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

    best explanation, thanks!

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

    amazing explanation

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

    Great job dude 🎉 tks

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

      You are welcome, thanks for watching :)

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

    Amazing content!

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

    no how implement? client component can use "use client", and then how to convert to server component for its subcomponent

  • @DK-ox7ze
    @DK-ox7ze Год назад

    Great video but code samples for both would have been nice.

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

    What I wasn't sure of css effects

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

    I understand what they are. I understand when to use either of them because it's obvious. But I don't understand HOW to use them, and you forgot to include that part...

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

      try putting
      "use Client";
      On the top of everything
      And it can solve your problem

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

    Awesome

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

    Nice

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

    Great video! I would appreciate to have small project tutorials using T3 full stack. Thank you

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

      Thank you! I will get into T3 full stack videos soon. Thanks for the comment :)

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

    Instead of rendering 5s of js on the client you will now be rendering 5s of js on the server! Increasing your server costs to speed up the client by WHOLE 5seconds!!!!!!!!!!!!!!!!!!

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

    Yea, not that complicated