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.
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()
@@khanhduy9378 I'm saying, there is no need to convert the entire page to a client page, it can remain a server page, but then you can use the router.refresh in a client component that you can import in the server page.
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?
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?
If I use generateMetada for asnyc title, I cannot "use client" on page.jsx. How to resolve this? Very nice tutorial
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.
I have this same question
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()
@@iamifechi need ''use client' to use the router.refresh()
@@khanhduy9378 I'm saying, there is no need to convert the entire page to a client page, it can remain a server page, but then you can use the router.refresh in a client component that you can import in the server page.
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?
Great
Why does the void function reset refresh the component to try again?
it is a inbuilt function to handle error, it re renders the component with error and if the content loaded successfully, error is gone
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?
fixed it myself i missed the step to setup "use client" on page.tsx aswell
GoodJob!
You don't need to do "use client"; on the page to ensure recovery.
I couldn't get mine to work until I added "use client" to the page.tsx file.
onClick must run in the browser.
This is not true. I couldn't get mine to work at all without the ''use client."
I had to write "use client" to make it work as tolbydamit mentionned to make it work
🙏👍