TanStackT
TanStack3y ago
3 replies
brilliant-lime

Next.js 13.4 app directory prefetch/hydrate questions

Hi Guys, Alka here
Right now i try to build my own personal blogs, preiously i try to make bloglist that has pagination with helps of tanstack query, which right now is working perfectly, but since it became client side components, i have some concen for my blog SEO so i want to use prefetching.

I have a questions for how to hydrate the client side components

here is my layout.tsx
(i attach in the attachement)

here is my BlogList.tsx
(i attach in the attachement)

i also implement the note or issues and its solutions that mentioned in the documentaions
1. providers
2. issues with typescript regarding the Hydrate (i use separate file called HydrateClient.tsx)
"use client";

import { Hydrate as RQHydrate, HydrateProps} from '@tanstack/react-query'

import React from 'react'

const Hydrate = (props: HydrateProps) => {
  return (
    <RQHydrate {...props}/>
  )
}

export default Hydrate

3. and use query-core for QueryClient and dehydrate when i import the functions.

i get error from my nextjs.

here is the error

- error Error: Not implemented.
    at BlogListWithPagination (./components/BlogList.tsx:29:94)

-  ┌ GET / 200 in 4838ms
   │
   └──── GET API.. 200 in 1081ms (cache: MISS)

- wait compiling /favicon.ico/route (client and server)...
- event compiled successfully in 73 ms (73 modules)
Was this page helpful?