nextui: [BUG] - You must wrap your application in an & Prop 'data-key' did not match
Describe the bug
The NextUI.Table Dynamic Table Throws an Error on Terminal (NextJS) :
When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.
And also a warning on Chrome DevTools :
Warning: Prop 'data-key' did not match. Server: "row-header-column-ilm253m8gg" Client: "row-header-column-57c34tinu8f"
Your Example Website or App
https://codesandbox.io/s/frosty-christian-nwei79
Steps to Reproduce the Bug or Issue
- Go to https://nextui.org/docs/components/table#custom-cells
- Try to use it with NextJS
Expected behavior
I Expect No Warnings
Screenshots or Videos

Operating System Version
Windows
Browser
Chrome
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 5
- Comments: 32 (2 by maintainers)
Links to this issue
Commits related to this issue
- fix(Provider): fix SSRProvider warning https://github.com/nextui-org/nextui/issues/779#issuecomment-1436844260 — committed to kuouu/yk-wp-theme by kuouu a year ago
Add in _app.tsx
Hey guys, that’s because you didn’t wrap your application in the “NextUIProvider”, please follow the installation steps: https://nextui.org/docs/guide/getting-started#next.js
import { useSSR } from ‘@nextui-org/react’
const { isBrowser } = useSSR()
isBrowser && ( <Component /> )
I’m getting this error too even though I’ve wrapped my app properly:
To the people above, this worked perfectly.
this disables server-side rendering
This happens because there’s a mismatch between the server-rendered content and the client-side rendered content, specifically the data-key.
Since NextUI needs “use client” anyway, both your custom Table compoenent and the NextThemesProvider component can be imported using next/dynamic and disable SSR completely.
This:
import TableX from './components/Table';import { ThemeProvider as NextThemesProvider } from "next-themes";To this:
const TableX = dynamic( () => import('./components/Table'), { ssr: false } );const NextThemesProvider = dynamic( () => import('next-themes').then((mod) => mod.ThemeProvider), { ssr: false } );Then use as imported normally.
I use v2, but still got this error using https://nextui.org/docs/components/table#custom-styles. (using Remix)
Problem disappears if I remove
selectionMode="multiple"from the table.This will disable SSR.
You should use this conditional
isBrowseronly on the offending component. Comment out segments and drill down to where it is.This is a workaround until we get v2 🪩
Seems to be a dependency issue. NextUI has
@react-aria/ssrlocked to3.3.0but some of the other @react-aria packages depend on^3.4.1. Therefore multiple versions are installed.I fixed it by adding the following to my package.json:
Edit: To get rid of client side warning you also have to add
"@react-aria/table": "^3.5.0". Maybe it’s best to update all aria dependencies, but not sure if there are any side effects 😅Edit 2: Doing this for
@react-aria/utilsgives me a build error though.I am using Next.js 13 and the new app/directory folder structure and i have this same issue, even after “use client”. In my case, there is no _app.tsx to wrap the provider to …
Where do I put this code?
I only have a blank page with the Navbar component from NextUI. Running without the component there’s no error, but running with the component there’s an error. I made the test without anything inside the Navbar.
I have same issue, but I can’t use the way that wrap with
useSSR()on v2. How can I solve this problem?Same! But with nextjs
How to use
NextUIProviderinlayout.tsxwith SSR?