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

129
Views
How to Import Component in React JS

I am trying to import Header Component in App.js but it's giving error.

import './App.css';
import Headers from './Components/Header';

function App() {
  return (
    <div>
    </Headers>
    </div>
  );
}

export default App;

Header.js

import React from "react";

export default function Headers(){
 
    return (
        <div>
        Header Demo
        </div>
    );
    
}

Header.js file exist in src/Components

Compiled with problems:X

ERROR in ./src/App.js

Module build failed (from ./node_modules/babel-loader/lib/index.js): SyntaxError: /home/sanad/Documents/newapp/src/App.js: Expected corresponding JSX closing tag for . (8:4)

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

0

Your problem has nothing to do with importing the module.

Read the error message carefully:

SyntaxError: /home/sanad/Documents/newapp/src/App.js: Expected corresponding JSX closing tag for <div>.

This is because you have a closing tag (</Headers>) but the next element that needs to be closed in <div>.

Your problem is that you need to open the <Headers> element first.

<div>
    <Headers></Headers>
</div>
about 4 years ago · Juan Pablo Isaza Report

0

import React from "react"; add this to App.js

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!