I have started working on Next.js and Next 13. When I try to use Redux Toolkit query in the page.tsx file (server), I get the error 'TypeError: (0, _react.createContext) is not a function,' and I haven't been able to figure out the reason for this. What am I doing wrong?
#When I try to use RDK query in page component (server) it gives error
9 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>
✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
(if you don't see the option, try refreshing Discord with Ctrl + R)
redux toolkit requires client components
same for any state management system
So how can I get data from api with SSR?
hmm something like this?
import PageClient from "./page-client";
export default async function Page() {
const data = await getData();
return <PageClient data={data} />;
}
"use client";
export default function PageClient({ data }) {
// use redux and everything client-side here
return <div />;
}
Oh I got it thanks so much
but I can't use redux toolkit query in ssr right?
as i said, anything that is related to client-side states must be in client components