Challenge - 5 Problems
Project Structure Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
š§ Conceptual
intermediateUnderstanding the purpose of the 'src' folder
In a React Native project, what is the main purpose of the 'src' folder?
Attempts:
2 left
š” Hint
Think about where you write your app's main code.
ā Incorrect
The 'src' folder is used to organize all source code files such as components, screens, and helper utilities. Configuration files and assets are usually stored elsewhere.
ā ui_behavior
intermediateEffect of placing components outside 'src' folder
What happens if you place React Native components outside the 'src' folder in a typical project?
Attempts:
2 left
š” Hint
Think about code organization and build process.
ā Incorrect
React Native does not require components to be inside 'src', but placing them outside can make the project messy and harder to maintain.
ā lifecycle
advancedRole of 'App.js' in project structure
In a React Native project, what is the role of the 'App.js' file in the project structure?
Attempts:
2 left
š” Hint
Think about what starts the app when it launches.
ā Incorrect
'App.js' is the main file that defines the root React component and is registered to start the app.
advanced
Where to place navigation files in project structure
Where is the best place to put navigation-related files in a React Native project?
Attempts:
2 left
š” Hint
Think about keeping related files organized.
ā Incorrect
Navigation files are best kept in their own folder inside 'src' to keep the project organized and maintainable.
š§ Debug
expertIdentifying cause of 'module not found' error
You moved a component file from 'src/components' to 'components' at the root level but now get a 'module not found' error when importing it. What is the most likely cause?
Attempts:
2 left
š” Hint
Check import statements after moving files.
ā Incorrect
When moving files, import paths must be updated to the new location. Otherwise, the bundler cannot find the module.
