Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where to fetch data using this component? #14

Open
danielmorena opened this issue Nov 17, 2024 · 2 comments
Open

Where to fetch data using this component? #14

danielmorena opened this issue Nov 17, 2024 · 2 comments

Comments

@danielmorena
Copy link

Hi, first of all, thanks for this solution, it works really well.

I have a question: where is the correct place to put the data fetcher? Since the root component of all pages is inside the TransitionRouter which is a client component, the pages will not be server components. Am I missing something?

@edoardolunardi
Copy link

Hi, first of all, thanks for this solution, it works really well.

I have a question: where is the correct place to put the data fetcher? Since the root component of all pages is inside the TransitionRouter which is a client component, the pages will not be server components. Am I missing something?

You can wrap any server component with a client component, and it will still behave like a server component. Have a look on the next.js site in case 👍 https://nextjs.org/docs/app/building-your-application/rendering/composition-patterns

@ismamz
Copy link
Owner

ismamz commented Nov 18, 2024

@danielmorena If you create a client component just to use the TransitionRouter, then everything (page, layout) can be server components without any problem. This is how all demos are made. Let me know if this answers your question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants