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

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

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?



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

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

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)

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!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.