Search code examples
create-react-app

'navigationBar' is declared but its value is never read.ts(6133)


I am working on a react-app that I just created but while I was testing it I received this error:

'navigationBar' is declared but its value is never read.ts(6133)

I am trying to import a component into my app.js in my react app for example:
import navigationBar from ./navigationBar

app.js:

import React from 'react';
import './App.css';
import navigationBar from './navigationBar'

function App() {
     return (
       <div>
         hello world
         <navigationBar />
       </div>
     );
}

export default App;

navigationBar.js:

import React, { Component } from 'react'

export default class navigationBar extends Component {
        render() {
            return (
                <div>
                    hey there
                </div>
            )
        }
} 

Solution

  • In JSX, lower-case tag names are considered to be HTML tags. So, even if you use navigationBar, it won't be considered as using the component.

    Use capital letter to begin the component name and you should be fine like NavigationBar