| title | React Class component rendered in a Server Component |
|---|
You are rendering a React Class Component in a Server Component, React.Component and React.PureComponent only works in Client Components.
Use a Function Component.
export default class Page extends React.Component {
render() {
return <p>Hello world</p>
}
}export default function Page() {
return <p>Hello world</p>
}Mark the component rendering the React Class Component as a Client Component by adding 'use client' at the top of the file.
export default class Page extends React.Component {
render() {
return <p>Hello world</p>
}
}'use client'
export default class Page extends React.Component {
render() {
return <p>Hello world</p>
}
}