Next.js Discord

Discord Forum

Combining use-client and use-server

Unanswered
Black Catbird posted this in #help-forum
Open in Discord
Black CatbirdOP
Just to make sure I'm understanding the docs ...

If I have a Route that will use server-side Data Fetching, but will also have an overarching useState variable to govern what components it shows, the normal pattern is to use the server-side page.tsx file as a wrapper and put all of its contents (and the useState variable) into a "use client" Component within the Route? Even if the Route has nothing else in its return other than this Component?

1 Reply

Yes, usually what i do is make the page.tsx and fetch on it, and make a client component called ClientWrapper and then forget about the page and work on it completely, the only area the page is seen, are the props i sent down