A
A
Alexander2019-10-27 15:01:03
React
Alexander, 2019-10-27 15:01:03

Why doesn't react see subfolder in src folder?

I created a simple react project where I created a components folder in the src folder and put two files Header.js and Feed.js into it. In the App.js file, I connect them, but an error occurs when connecting to projects.
What could be the reason for the error?
My code :

import React from 'react';

// import Feed from './Feed';
// import Header from './Header';
import Header from './components/Header';
import Feed from './components/Feed';

function App() {
  return (
    <div className="App">
      <Header/>
       <Feed/>
    </div>
  );
}

export default App;

In the guide I'm making, the author also includes files using a subfolder and doesn't have any errors.
Error message text : "Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Check the render method of `App`."

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
abberati, 2019-10-27
@inviziblll

The error says: “I connected everything and started rendering, but in your connected files some nonsense is exported, not a component.”

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question