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

145
Views
Getting a blank page from reactJS

The following code snippets are giving me this error.

Line 2:10:  'navBar' is defined but never used  no-unused-vars

What am I doing wrong?

App.js

import React from 'react'
import { navBar } from './components/navBar'

const App = () => {
  return (
      <navBar/>
  )
}

export default App

navBar.js

import React from 'react';
import {  Link } from "react-router-dom";
const navBar= () =>{
  return (
  <div>
    <li>
      <Link to="/">Dogs</Link>
    </li>
    <li>
      <Link to="/cats">Cats</Link>
    </li>
    <li>
      <Link to="/sheeps">Sheeps</Link>
    </li>
    <li>
      <Link to="/goats">Goats</Link>
    </li>
  </div>
  );
}
export default navBar
about 4 years ago · Santiago Gelvez
3 answers
Answer question

0

When creating a React component, the component's name MUST start with an upper case letter.

If you used export default then no need to use {} just import without {} and use it

import NavBar from './components/NavBar'

about 4 years ago · Santiago Gelvez Report

0

The <Link> component is supposed to be used inside BrowserRouter.

import React from "react";
import { Link, BrowserRouter as Router } from "react-router-dom";

export default function NavBar() {
  return (
    <Router>
        <ul>
          <li>
            <Link to="/">Dogs</Link>
          </li>
          <li>
            <Link to="/cats">Cats</Link>
          </li>
          <li>
            <Link to="/sheeps">Sheeps</Link>
          </li>
          <li>
            <Link to="/goats">Goats</Link>
          </li>
        </ul>
    </Router>
  );
}

about 4 years ago · Santiago Gelvez Report

0

Because you use export default, you should fix to

import navBar from './components/NavBar'

And named follow coding convention navBar to NavBar.

about 4 years ago · Santiago Gelvez 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!