I’m trying to use RequestClient with Next.js 13. When I create a layout and page file under my app directory with this following code
In app/page.tsx
async function fetch() {
const headersList = headers();
const cookie = headersList.get('cookie');
const client: RequestClient<ModelTypes> = new RequestClient({ aliases, ceramic: 'testnet-clay', cookie: cookie || '' })
if (client.viewerID != null) {
// If the viewerID is set, fetch its profile
await client.prefetch('basicProfile', client.viewerID)
}
return { props: { state: client.getState() } }
}
async function Test() {
const result = await fetch();
console.log('results', { result })
return (<>empty for now</>)
}
export default Test
creating a ReactClient inside page.tsx gives this error
Error msg: You’re importing a component that needs useReducer. It only works in a Client Component but none of its parents are marked with “use client”
but isn’t RequestClient supposed to help with server side rendering?