Next.js Discord

Discord Forum

How to use `useParams` and `metadata` at the same time inside a page?

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
Hey everyone, I was trying to use useParams but then nextjs alerted me that I need to declare use client at the top of the page. As I need to use useParams to retrieve something from the params, how am I supposed to use the metadata since next does not allow using metadata with use client?
'use client'

import { Metadata } from 'next'
import { useParams } from 'next/navigation'
import { SignInForm } from '~/components/pages/home/sign-in-form'

export const metadata: Metadata = {
  title: 'Sign In',
}

export default function Page() {
  const params = useParams()

  return <SignInForm />
}

1 Reply