0

I am getting error on react that say failed to compile and ./src/App.js

I notice that on route exact path "ListingDetail" got yellow highlight and others are blue highlight Module not found: Can't resolve './containers/ListingDetail'

enter image description here

Spyham7
  • 21
  • 4
  • Can you share how `ListingDetail` is exported? – Drew Reese Nov 26 '20 at 04:38
  • Does this help you? https://stackoverflow.com/questions/21117160/what-is-export-default-in-javascript Or this one? https://stackoverflow.com/questions/36569961/es6-default-and-named-exports – Drew Reese Nov 26 '20 at 05:13

2 Answers2

0

You have a problem with the way you export the component.

Let me explain, In React we use the keyword export to export a particular module or a named parameter or a combination.

Exporting default export

export default ListingDetail;

This is to export the whole component as default.

Exporting named values

export { PARA_NAME }

Every component can have several named parameters and in order to export one we should use the upper syntax

Here you wanted to export the whole component; then you need to use the 1st approach.

SE32433
  • 91
  • 6
0

I have found my own error that the file was save as ListingsDetail.js so I took s off to save as ListingDetail.js

Spyham7
  • 21
  • 4