Next.js 14 Tutorial - 25 - Recovering from Errors

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

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

  • @RichardGeorge-z8e
    @RichardGeorge-z8e หลายเดือนก่อน

    If I use generateMetada for asnyc title, I cannot "use client" on page.jsx. How to resolve this? Very nice tutorial

  • @himanshurawat3934
    @himanshurawat3934 9 หลายเดือนก่อน +11

    my question is in order to do reset we are moving server side page to client side which will affect seo so how to do the same without doing page.tsx file to useclient
    so that we get server sdie benefits also and this error.tsx reset benefit also.

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

      I have this same question

    • @iamifechi
      @iamifechi 3 หลายเดือนก่อน +2

      You actually dont need to make your page a client component.
      I had to create a reload function with startTransition and router.refresh as
      const reload = () => {
      startTransition(() => {
      router.refresh();
      reset && reset();
      });
      };
      to use in place of the reset()

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

    am i the only one having the problem that the reset ist not working as is should in the example it will rerender the body but never reset the value from the const random so the error stays forever until browser refresh?

    • @finalphoenixable
      @finalphoenixable 2 หลายเดือนก่อน +1

      fixed it myself i missed the step to setup "use client" on page.tsx aswell

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

    Great

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

    GoodJob!

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

    Why does the void function reset refresh the component to try again?

    • @h_A_m_za
      @h_A_m_za 4 หลายเดือนก่อน +1

      it is a inbuilt function to handle error, it re renders the component with error and if the content loaded successfully, error is gone

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

    🙏👍

  • @RichardGeorge-z8e
    @RichardGeorge-z8e หลายเดือนก่อน

    Very nice explanation Sir. if on this page.tsx, I use async operation to get dynamic title. I have export generateMetadata, I cannot "use client" due to handle error! how to resolve this?

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

    You don't need to do "use client"; on the page to ensure recovery.

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

      I couldn't get mine to work until I added "use client" to the page.tsx file.
      onClick must run in the browser.

    • @tolbydamit
      @tolbydamit 7 หลายเดือนก่อน +5

      This is not true. I couldn't get mine to work at all without the ''use client."

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

      I had to write "use client" to make it work as tolbydamit mentionned to make it work