Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

228
Views
Importing App into react js results on module error

Im making a simple typescript project, but can't manage to solve the following error:

Compiled with problems: ERROR in ./src/index.tsx 7:0-28 Module not found: Error: Can't resolve './App' in '/Projects/test/src'

Any suggestions??

Here's the files..

Home:

import React from "react"

export const Home = () => {
    return (
        <>
            <div>
                <p>Essa é a pagina home</p>
            </div>
        </>
    );
};

export default Home;

App.tsx:

import React from 'react';
import { Home } from './pages/Home';

export function App() {
  return (
      <Home />
  );
};

index.tsx:

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import { App } from './App';

const ApplicationWrapper = () => {
  return (
    <App />
  );
};

ReactDOM.render(
  <React.StrictMode>
    <ApplicationWrapper />
  </React.StrictMode>,
  document.getElementById('main'),
);

FILE STRUCTURE:

File Structure

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

When the code is exported and with a default keyword, that means you only can import by using import Alias from './module'. If you want to import through Object Destructuring, it needs to export a Component or module without using the default keyword.

Last line of Home component.

export { Home };

When it needs to import.

import { Home } from './path-to-component';
about 4 years ago · Juan Pablo Isaza Report

0

you can export once at Home component like this:

import React from "react"

const Home = () => {
    return (
        <>
            <div>
                <p>Essa é a pagina home</p>
            </div>
        </>
    );
};

export default Home;
about 4 years ago · Juan Pablo Isaza Report

0

Please check, App.tsx file should be in index.tsx folder. ie both files should be in /Projects/test/src folder.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!