Issue with Logging on the Client Side in Next.js 14 with TypeScript
Unanswered
Cuvier’s Dwarf Caiman posted this in #help-forum
Cuvier’s Dwarf CaimanOP
I'm facing a challenge with server-side logging in my Next.js 14 project that uses TypeScript.
Specifically, I'm observing that log messages are being displayed on the server side, even though I intend them to be client-side logs.
The problem is that the message in stores/page.tsx is intended to be displayed only on the client side. However, it is observed that this message is also displayed on the server side during the initial rendering of the page.
but in storeInfo.tsx it works fine
Additional Information:
I'm using Next.js 14 with TypeScript.
I'm looking for a solution that doesn't involve using conditions or useEffect to avoid the server-side logging and the related error.
I appreciate any insights or suggestions for resolving this issue. Thank you!
Specifically, I'm observing that log messages are being displayed on the server side, even though I intend them to be client-side logs.
The problem is that the message in stores/page.tsx is intended to be displayed only on the client side. However, it is observed that this message is also displayed on the server side during the initial rendering of the page.
but in storeInfo.tsx it works fine
Additional Information:
I'm using Next.js 14 with TypeScript.
I'm looking for a solution that doesn't involve using conditions or useEffect to avoid the server-side logging and the related error.
I appreciate any insights or suggestions for resolving this issue. Thank you!
1 Reply
Cuvier’s Dwarf CaimanOP
The main problem is when i try to get value from localstorage in pages they handle error that's localstorage is undefined during the initial rendering