0

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.

2
  • Try adding a relative path: import Home from './Home'; Commented Jul 29, 2017 at 22:21
  • That seems to solve the issue, thanks! I did attempt that earlier, however you have to exit out of the terminal and the ios simulator for it reset which I did not know. Commented Jul 29, 2017 at 22:28

1 Answer 1

2

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 
Sign up to request clarification or add additional context in comments.

1 Comment

So far, it seems to work without the export default Home line. What is its purpose?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.