I'm building a project using Next.js 15 and Chakra UI 3. In my layout.js file, I have the following setup:
import { Provider } from '@/components/ui/provider';
export default function RootLayout({ children }) {
return (
<html suppressHydrationWarning>
<body>
<Provider>{children}</Provider>
</body>
</html>
);
}
provider.jsx
'use client';
import { ChakraProvider, defaultSystem } from '@chakra-ui/react';
import { ColorModeProvider } from './color-mode';
export function Provider(props) {
return (
<ChakraProvider value={defaultSystem}>
<ColorModeProvider {...props} />
</ChakraProvider>
);
}
pages.jsx
export default function Home() {
return <div>Hello World!</div>;
}
However, I'm encountering the following error:
Hydration failed because the server-rendered HTML didn't match the client. As a result, this tree will be regenerated on the client. This can happen if a SSR-ed Client Component is used.
How can I resolve this issue? Any suggestions on correctly setting up SSR with Chakra UI in Next.js would be appreciated.
Edit:
next dev --turbopack throws an error. I didn't encounter any issues without the --turbopack flag. The Chakra UI developers are working on the issue.
--turbopackflag fixed it for me as well. You also mentioned the Chakra UI developers are working on the issue. Do you have a link to that issue?