NextJS Onload Function

I was trying to check whether an user has an auth token in cookies on load. And if it is there I was passing down that token to a client component to change client auth state as it was required to perform some other UX based things. Now, in my approach I was doing it in layout.tsx but when built the app it showed now everypage is by default using server side rendering. So, my question is there a better way to this above mentioned stuff like moving it into some other component and just making the pages statically render reducing the server cost. Or is it the only way to do this stuff and if so is there any performance hits that I would face or any cost related hits in production. Also if there is a better way to do this please mention? Thanks in advance.
0 Replies
No replies yetBe the first to reply to this messageJoin