DEV Community

Discussion on: React Query v4 + SSR in Next JS

Collapse
 
arianhamdi profile image
Arian Hamdi

There are a few tradeoffs to consider when compared to the hydration / dehydration approach:

  • If you are calling useQuery in a component deeper down in the tree you need to pass the initialData down to that point.

  • If you are calling useQuery with the same query in multiple locations, you need to pass initialData to all of them.

  • There is no way to know at what time the query was fetched on the server, so dataUpdatedAt and determining if the query needs refetching is based on when the page loaded instead.

For more information please check here.

Collapse
 
joostschuur profile image
Joost Schuur

I've just migrated over to the de/hydrate based approach, and so far, so good!

Thanks for the pointer to dataUpdatedAt too!