Skip to content

with SSG/SSR how to render a deep nested component which requires fetch to render #11190

Answered by timneutkens
dohomi asked this question in Help
Discussion options

You must be logged in to vote

In general you should do this data fetching at the top level.

However there's a few ways that you can do performant data fetching with nesting without doing full React tree rendering, eg Apollo getDataFromTree does a full React tree render for every Query component or hook that you use which is generally not what you want for performance reasons.

@jescalan created a relay-like library that works pretty well: https://github.com/hashicorp/rivet-graphql
You can use a similar approach not just for GraphQL.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by dohomi
Comment options

You must be logged in to vote
1 reply
@timneutkens
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants