Home > Blockchain >  ./src/index.js Cannot find file: 'App.js' does not match the corresponding name on disk: &
./src/index.js Cannot find file: 'App.js' does not match the corresponding name on disk: &

Time:10-07

I have this error:

./src/index.js
Cannot find file: 'App.js' does not match the corresponding name on disk: '.\src\components\Components'.

And I've been having a lot of trouble fixing it, I think it has something to do with the import but I'm not exactly sure what it is exactly. In the command prompt it tells me to run "npm update" But when I do I get an error. I'm just overall confused. Please help..

import  { Components } from 'react';

class App extends Components {
    return() {
        return (
            <div>
                <h1>NFT Marketplace</h1>
            </div>
        )
    }
}

export default App;

CodePudding user response:

It should be

  • Component not Components and

  • render() for return()

      import { Component } from "react";
    
      class App extends Component {
        render() {
          return (
            <div>
              <h1>NFT Marketplace</h1>
            </div>
         );
        }
      }
    
      export default App;
    

Or another way you could write is

import React from "react";

class App extends React.Component {....}

CodePudding user response:

Here is your solution

import React from 'react';

class App extends React.Component {

    render() {
        return (
            <div>
                <h1>NFT Marketplace</h1>
            </div>
        )
    }
}

export default App;

CodePudding user response:

In index.js this [import App from './App';]is not found. That's why throwing an error.

Plz correct your App.js file:

class App extends Component {
    render() {
        return (
            <div>
                <h1>NFT Marketplace</h1>
            </div>
        )
    }
}

export default App;

CodePudding user response:

It should be Component AND render(){...}

import { Component } from "react";

class App extends Component {
  render() {
    return (
      <div>
        <h1>NFT Marketplace</h1>
      </div>
    );
  }
}

export default App;
  • Related