Challenge - 5 Problems
React Project Structure Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
Understanding React project folder roles
In a typical React project, which folder usually contains reusable UI components like buttons and headers?
Attempts:
2 left
💡 Hint
Think about where you keep pieces you use many times in your app.
✗ Incorrect
The src/components folder holds reusable UI parts like buttons and headers. The public folder is for static files, node_modules stores installed packages, and src/assets holds images or styles.
❓ component_behavior
intermediate2:00remaining
Effect of placing files in public folder
What happens if you put an image file inside the
public folder and reference it in your React app?Attempts:
2 left
💡 Hint
Think about how static files are handled in web projects.
✗ Incorrect
Files in the public folder are served directly as static assets. They are not processed by React but can be accessed via URL paths.
📝 Syntax
advanced2:00remaining
Correct import path for a component
Given a React project with this structure:
Which import statement correctly imports
src/
components/
Button.jsx
App.jsxWhich import statement correctly imports
Button into App.jsx?Attempts:
2 left
💡 Hint
Consider the relative path from App.jsx to Button.jsx.
✗ Incorrect
Since App.jsx and components are both inside src, the correct relative path is ./components/Button.
🔧 Debug
advanced2:00remaining
Why does this React app fail to find a CSS file?
A developer places
Why does this cause an error?
styles.css inside src/assets but imports it in App.jsx as:import '../assets/styles.css';
Why does this cause an error?
Attempts:
2 left
💡 Hint
Check the relative path carefully from App.jsx location.
✗ Incorrect
Since App.jsx is inside src, using ../assets tries to go outside src, which is invalid. The correct path is ./assets/styles.css.
❓ state_output
expert2:00remaining
Effect of moving stateful logic to a separate folder
In a React project, a developer moves all custom hooks managing state from
src/components to src/hooks. What is the main benefit of this change?Attempts:
2 left
💡 Hint
Think about how separating concerns helps in bigger projects.
✗ Incorrect
Moving custom hooks to a dedicated src/hooks folder helps keep UI components focused on display, while hooks handle state logic. This separation makes the code cleaner and easier to maintain.