skip to Main Content

I have this error:

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

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;

4

Answers


  1. 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;
    
    Login or Signup to reply.
  2. 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 {....}
    
    Login or Signup to reply.
  3. Here is your solution

    import React from 'react';
    
    class App extends React.Component {
    
        render() {
            return (
                <div>
                    <h1>NFT Marketplace</h1>
                </div>
            )
        }
    }
    
    export default App;
    
    Login or Signup to reply.
  4. 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;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search