Getting an Error as Error: React.Children.only expected to receive a single React element child.
While Integrating Internet Identity on Next.
Here’s the layout.tsx file
import { Analytics } from '@vercel/analytics/react'
import { cn } from '@/lib/utils'
import { TailwindIndicator } from '@/components/tailwind-indicator'
import { Providers } from '@/components/providers'
import { Header } from '@/components/header'
import { Toaster } from '@/components/ui/sonner'
import { KasadaClient } from '@/lib/kasada/kasada-client'
import { IdentityProvider } from '../context/AppContext'
export const metadata = {
metadataBase: new URL('https://gemini.vercel.ai'),
title: {
default: 'abc',
template: ``
},
description:
'xyz',
icons: {
icon: '/favicon.ico',
shortcut: '/favicon-16x16.png',
apple: '/apple-touch-icon.png'
}
}
export const viewport = {
themeColor: [
{ media: '(prefers-color-scheme: light)', color: 'white' },
{ media: '(prefers-color-scheme: dark)', color: 'black' }
]
}
interface RootLayoutProps {
children: React.ReactNode
}
export default function RootLayout({ children }: RootLayoutProps) {
return (
<html lang="en" suppressHydrationWarning>
<body
className={cn(
'font-sans antialiased',
GeistSans.variable,
GeistMono.variable
)}
>
<IdentityProvider>
<KasadaClient />
<Toaster position="top-center" />
<Providers
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
<div className="flex flex-col min-h-screen bg-black">
<Header />
<main className="flex flex-col flex-1">{children}</main>
</div>
<TailwindIndicator />
</Providers>
<Analytics />
</IdentityProvider>
</body>
</html>
)
}
Providers.tsx file
'use client'
import * as React from 'react'
import { ThemeProvider as NextThemesProvider } from 'next-themes'
import { ThemeProviderProps } from 'next-themes/dist/types'
import { SidebarProvider } from '@/lib/hooks/use-sidebar'
import { TooltipProvider } from '@/components/ui/tooltip'
export function Providers({ children, ...props }: ThemeProviderProps) {
return (
<NextThemesProvider {...props}>
<SidebarProvider>
<TooltipProvider>{children}</TooltipProvider>
</SidebarProvider>
</NextThemesProvider>
)
}
Been stuck here for long. Can anybody help?
Thanking you in advance