0
0
Reactframework~20 mins

Project structure overview in React - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
React Project Structure Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding React project folder roles
In a typical React project, which folder usually contains reusable UI components like buttons and headers?
Apublic
Bsrc/components
Cnode_modules
Dsrc/assets
Attempts:
2 left
💡 Hint
Think about where you keep pieces you use many times in your app.
component_behavior
intermediate
2: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?
AThe image will cause a build error.
BThe image is bundled and optimized by React automatically.
CThe image cannot be accessed by the app at all.
DThe image is served as a static file and can be accessed via a URL path.
Attempts:
2 left
💡 Hint
Think about how static files are handled in web projects.
📝 Syntax
advanced
2:00remaining
Correct import path for a component
Given a React project with this structure:
src/
  components/
    Button.jsx
  App.jsx

Which import statement correctly imports Button into App.jsx?
Aimport Button from './components/Button';
Bimport Button from '../components/Button';
Cimport Button from './Button';
Dimport Button from 'components/Button';
Attempts:
2 left
💡 Hint
Consider the relative path from App.jsx to Button.jsx.
🔧 Debug
advanced
2:00remaining
Why does this React app fail to find a CSS file?
A developer places styles.css inside src/assets but imports it in App.jsx as:
import '../assets/styles.css';

Why does this cause an error?
AThe file extension must be .module.css to import CSS.
BCSS files cannot be imported in React components.
CThe import path is incorrect because <code>App.jsx</code> is inside <code>src</code>, so '../assets' goes outside <code>src</code> which doesn't exist.
DThe assets folder must be inside public to import CSS.
Attempts:
2 left
💡 Hint
Check the relative path carefully from App.jsx location.
state_output
expert
2: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?
AIt improves code organization by separating UI components from state logic, making the project easier to maintain.
BIt automatically optimizes the app performance by React.
CIt prevents components from re-rendering unnecessarily.
DIt causes the app to break because hooks must be inside components.
Attempts:
2 left
💡 Hint
Think about how separating concerns helps in bigger projects.