Next.js Discord

Discord Forum

Server Component as Props in Client Component

Unanswered
Western thatching ant posted this in #help-forum
Open in Discord
Western thatching antOP
Hello guys, I am making something like tweets, i try to show the comments of a tweet when i click on the comment button. The comments is a server component, and the tweet is a client component. I tried the instruction in https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns#supported-pattern-passing-server-components-to-client-components-as-propsm, but my problem is <Comments/> is always run as the page loaded, but what i want is run it after i click on comment button by render it like {isCommentOpen && children} in client component, I don't want all the comments be loaded before users open the comment section. Can anyone help?

0 Replies