Home does not contain an export named Home Home does not contain an export named Home reactjs reactjs

Home does not contain an export named Home


The error is telling you that you are importing incorrectly. Here's the code you have to add:

import { Home } from './layouts/Home';

This is incorrect because you're exporting as the default export, not as a named export. Check this line:

export default Home;

You're exporting as default, not as a name. Thus, import Home like this:

import Home from './layouts/Home';

Notice there are no curly brackets. Further reading on import and export.


Use

import Home from './layouts/Home'

rather than

import { Home } from './layouts/Home'

Remove {} from Home


This is a case where you mixed up default exports and named exports.

When dealing with the named exports, if you try to import them you should use curly braces as below,

import { Home } from './layouts/Home'; // if the Home is a named export

In your case the Home was exported as a default one. This is the one that will get imported from the module, when you don’t specify a certain name of a certain piece of code. When you import, and omit the curly braces, it will look for the default export in the module you’re importing from. So your import should be,

import Home from './layouts/Home'; // if the Home is a default export

Some references to look :