Reputation: 23
I am getting this error whenever I try to import a new js page. I am fairly new to react-native so this might be an easy error to fix or it might be a bug on their side at the moment, I am not sure.
This is my import line ->
import Home from 'Home';
Both files are in the same directory. The error I get is it says
unable to resolve module 'Home' from 'path/App.js' : Module does not exist in the module map'.
Now what confuses me is that the path on the error is App.js when I am trying to specify a file called Home.js.
Upvotes: 0
Views: 1206
Reputation: 363
You probably want to use a relative import like this:
import Home from './Home';
Of course, that is assuming the Home component is in the same level as your App component and that you exported it as the default export:
export default Home
Upvotes: 2