When I use this code in code sandbox its work:
// File Photo.js
export default Photo;
// File index.js
export Photo from "./Photo/Photo";
export Comments from "./Comments/Comments";
But when I install the project using GitHub on my local machine its not working until I change the code to this:
// File Photo.js is the same
// File index.js
import Photo from "./Photo/Photo";
import Comments from "./Comments/Comments";
export default {
Photo,
Comments
};
The error is shown on my local machine './../components' does not contain an export named 'Photo'
Hello @YazanAabeed
You can't use the "default export" for the two components in this way.
In this situation, it is correct to use "named export".
You can check this example, it works both in the sandbox and on the local machine
Hello @Komar0ff
Thank you for your help and your time 馃槃 馃敟
Closing this one since it's solved! Thanks @Komar0ff 馃槃
Most helpful comment
Closing this one since it's solved! Thanks @Komar0ff 馃槃