T
TanStack3y ago
stormy-gold

Any way to use react-query without use 'use client' in layout.tsx in nestjs

'use client'
import { Metadata } from 'next'
import './globals.css'
import './variables.module.scss'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'

const queryClient = new QueryClient()

export const metadata: Metadata = {
title: 'Transpomate',
description: 'Transpomate is a transport management system',
}

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<QueryClientProvider client={queryClient}>
<html lang='en'>
<body>{children}</body>
</html>
</QueryClientProvider>
)
}
'use client'
import { Metadata } from 'next'
import './globals.css'
import './variables.module.scss'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'

const queryClient = new QueryClient()

export const metadata: Metadata = {
title: 'Transpomate',
description: 'Transpomate is a transport management system',
}

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<QueryClientProvider client={queryClient}>
<html lang='en'>
<body>{children}</body>
</html>
</QueryClientProvider>
)
}
my metadata APPI wont work when i use use client
1 Reply
like-gold
like-gold3y ago
put the providers in it's own file like the docs suggest

Did you find this page helpful?