reactjsnext.jsgetserversideprops

Calling getServerSideProps doesn't work as expected


export async function getServerSideProps() {
  return {
    props: {
      abc: '123'
    }
  }
}

export default function Movie({ abc }) {
  console.log(abc)

  return (
    <>
      <h1>{abc || 'not found'}</h1>
    </>
  )
}

At the page it returns not found, and the console returns undefined

Versions of my dependencies:

  next@^15.1.6
  react@^19.0.0
  react-dom@^19.0.0

Solution

  • The problem is that im using /pages/_app.jsx, getServerSideProps cannot be used with _app.jsx