Proper way to change document title in use client page?
Answered
Parson Russell Terrier posted this in #help-forum
Parson Russell TerrierOP
I have a page that needs
use client at the top. I realized I cannot use export const metadata as it throws an error. Is the only way to set the title to use document.title =? Or is there another suggested method for use client pages?Answered by Ray
but I would suggest turning the page component to server component and render a client component
6 Replies
@Parson Russell Terrier I have a page that needs `use client` at the top. I realized I cannot use `export const metadata` as it throws an error. Is the only way to set the title to use `document.title =`? Or is there another suggested method for `use client` pages?
but I would suggest turning the page component to server component and render a client component
Answer
Parson Russell TerrierOP
Ok thank you.
I have components that get passed refs, so is it still possible to remove
I have components that get passed refs, so is it still possible to remove
use client? Because I need to create the refs on the page and I can only create refs on client pages right?@Parson Russell Terrier Ok thank you.
I have components that get passed refs, so is it still possible to remove `use client`? Because I need to create the refs on the page and I can only create refs on client pages right?
basically, just copy every thing on the page right now, and paste the code in a new file
then your page will be something like this
import PageClient from './page.client'
export const metadata = {}
export default function Page() {
return <PageClient />
}Parson Russell TerrierOP
Ok thank you