Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

299
Visualizações
Property 'getLayout' does not exist in Reactjs

I am working with Reactjs and using Nextjs,Right now i am trying to "Use multiple Headers" (according to condition) , I used following code in my "about.js" file

import React from 'react'
import NestedLayout from '../components/NestedLayout'
import Footer from '../components/Footer'

function About() {
  return (
    <>
 <>
    //CODE HERE
 </>
  </>
  )
}
export default About
About.getLayout= function PageLayout(page)
{
    return(
        <>
            <NestedLayout />
            {page}
            <Footer />
        </>
    )
}

And here is my "_app.js" file

import React from 'react';
import App from 'next/app';
import Layout from '../components/layout'
import type { AppProps } from 'next/app'
function MyApp({ Component, pageProps }: AppProps) {
  
  if(Component.getLayout)
  {
      return Component.getLayout(<Component{...pageProps} />)
  }
  return (
    <>
     <Layout>
     <Component {...pageProps} />
     </Layout>
    </>
   )
}
export default MyApp

But i am getting following error,How can i solve this ?

any
Property 'getLayout' does not exist on type 'NextComponentType<NextPageContext, any, {}>'.
  Property 'getLayout' does not exist on type 'ComponentClass<{}, any> & { getInitialProps?(context: NextPageContext): any; }'.ts(2339)
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda