Which path should I use to import a .js in an Expo folder to a snack?


#1

The .js files are in the “components” folder. Shoud I use import Article from ‘./components/Article’;?


#2

Hey @cabteix,

It all depends on your path relative to where you are importing the component from. Can you share your project’s tree structure?

Cheers,

Adam


#3

hey @adamjnav! please find it here…58%20PM


#4

If you’re using it in the app.js file, then yes import Article from './components/Article would be the correct way.


#5

just wanted to confirm that because I get a "The component for route ‘Home’ must be a React component! error message… it’s most likely related to screen navigation… and I don’t have this issue if the class is on the Apps.js itself (not in a separate .js file)


#6

just found the answer at stackoverflow… each screen class must have an “export default” clause for the class… if they are in the App.js they must NOT have it because the “export” element is already in the createAppContainer piece… thanks anyway!