Reputation: 195
I am new to programming and react, I have a component called App, on App [line 16] I am trying to import a component called Gallery by typing import Gallery from "/Gallery"
but that is not working, here is a screenshot
Upvotes: 0
Views: 42
Reputation: 352
This is not specific to React, it is ES6 module import.
App is not in the same folder as Gallery so you need to specify the path. Try import Gallery from './Components/Gallery'
Check http://exploringjs.com/es6/ch_modules.html for more information.
Upvotes: 2
Reputation: 32003
Your path is wrong. It should be ./Components/Gallery
since it's in the same folder as the current component. /Gallery
goes all the way to the root.
Upvotes: 2
Reputation: 589
Your Gallery file is inside the Components folder, therefore you need to give the exact path to the component, in this case './Components/Gallery'
Upvotes: 4