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

219
Visualizações
Failing to import react components to link multiple pages

I have had a simple react app with several different linked pages for quite some time now. It has been functioning for months, but I must have done something in the last week to make all of my exported modules undefined. I run into the following 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.

Within my project folder, I have my my src folder which has my index.js file that configures all of my different modules. Here it is below:

import { React } from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import reportWebVitals from './reportWebVitals';
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import {
  Navigation,
  Home,
  Register,
  Dashboard,
  Marketplace,
  Signup,
  Monitor,
  DSODash
} from "./Components";

ReactDOM.render(
  <Router>
    <Navigation />
    <Routes>
      <Route path="/" element={<Home />} />
      <Route path="/register" element={<Register />} />
      <Route path="/dashboard" element={<Dashboard />} />
      <Route path="/marketplace" element={<Marketplace />} />
      <Route path="/signup" element={<Signup />}/>
      <Route path="/monitor" element={<Monitor />}/>
      <Route path="/dso" element={<DSODash />}/>
    </Routes>
  </Router>,

  document.getElementById("root")
);

reportWebVitals();

Within my src folder is a folder called Components. I have several .jsx files that build individual pages. Each of these files are written as functions and the file ends with

export default (function name);

Also within my Components folder, I have an index file that exports each component. Here is the code below:

export { default as Navigation } from "./Navigation";
export { default as Home } from "./Home";
export { default as Register } from "./Register";
export { default as Dashboard } from "./Dashboard";
export { default as Marketplace } from "./Marketplace";
export { default as Signup } from "./Signup";
export { default as Monitor } from "./Monitor";
export { default as DSODash } from "./DSODash"
export { default as Base } from "./base"

It seems that somehow my components are failing to export and causes the platform to run into an error. I am lost here, and any help would be great. Maybe I need to be importing my index.js file from within the src/Components folder to the index.js file in the src folder. Thanks!

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

0

I had a truffle-config.js file in the same folder. Somehow this configuration file must have been interfering with the react rendering.

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