Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

113
Vistas
Type '{ children: Element; }' has no properties in common with type 'IntrinsicAttributes' on react layout component

This is the code for the layout

import type { NextPage } from 'next'
import React from 'react'
 
interface LayoutProps {
 children: React.ReactNode;
}
 
const Layout: NextPage = ({ children }: LayoutProps) => {
 return (
   <>
     <div>
       <main>
         {children}
       </main>
     </div>
   </>
 );
};
 
 
export default Layout

The error appears when I hover over the start of the layout element in this block of code which is the main part of the app.

import type { AppProps } from 'next/app'
import Layout from '../components/Layout'
import '../styles/globals.css'
 
function MyApp({ Component, pageProps }: AppProps) {
 return (
   <Layout>
     <Component {...pageProps} />
   </Layout>
 )
}
export default MyApp

I thought at first that it was because I didn’t have the right type for the children but I made a type for the children but I made an interface for that but I still am receiving the error.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Try with generics

import type { NextPage } from 'next'
import React from 'react'
 
interface LayoutProps {
 children: React.ReactNode;
}
 
const Layout: NextPage<LayoutProps> = ({ children }) => {
 return (
   <>
     <div>
       <main>
         {children}
       </main>
     </div>
   </>
 );
};
 
 
export default Layout
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda