#Client Context vs Server Side Props Drilling

4 messages · Page 1 of 1 (latest)

autumn thorn
#

I have a rather general qn because I am not an expert on the App router.

We have an App that starts with Server Components and then on certain subpages we introduce client side stuff at some point.

If I have a user for example, would I fetch this user on the server side and "drill it down" all the way to the client components? Seems like an antipattern.

My take would be to create a context at the root and pass it there to access from anywhere in my app on the client side. However, then I am not sure about the sync state between client and server side for that user endpoint.

Is there a go to strategy here? Thanks so much for any pointers 🙂

merry estuaryBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

fiery elbow
autumn thorn
#

Thanks I am actually doing that. My qn is more about how to "drill it down" to client side components. I fetch the user in the root layout and pass it down. But I do not want to drill it to 4-5 child components...