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

358
Visualizações
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined Next JS

Main.js

import {
  Navbar,
  Footer,
  Landing,
  About,
  Skills,
  Testimonials,
  Blog,
  Contacts,
  Projects,
  Services,
  Portfolio,
} from "../../components";

function Main() {
  return (
    <div>
      <Navbar />
      <Landing />
      <About />
      <Skills />
      <Projects />
      <Portfolio />
      <Services />
      <Testimonials />
      <Blog />
      <Contacts />
      <Footer />
    </div>
  );
}

export default Main;

index.js

import { Head } from "next/Head";
import { Main } from './Main/Main';
import { headerData } from "../data/headerData";

export default function Home() {
  return (
    <div>
      <Head>
        <title>{headerData.name}</title>
        <link rel="icon" href="./channels4_profile.jpg" />
      </Head>

      <Main />
    </div>
  );
}

The error: Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Please Please The Solution

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Like cmgchess alluded to in the comments, since you are using export default Main; you don't import it as a named function.

Change this: import { Main } from './Main/Main'; to this: import Main from './Main/Main';

If that doesn't work, see if you can get a simpler version of Main to import at all. Try something like:

function Main() {
  return (
    <div>
      Main imported
    </div>
  );
}

If you can get that working, add back the other components one by one until you find which one is causing the issue.

about 4 years ago · Juan Pablo Isaza Relatório
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