Project Structure and Conventions — Concept Check
Questions on Project Structure and Conventions. Group by feature, not by file type. The folder layout that feels tidy at ten components is the one that becomes unnavigable at two hundred.
Questions in this quiz
8 questions on Project Structure and Conventions — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.You are tasked with deleting the 'problems' feature from a React project. What should you do?
- AClear entries in 'utils/' and 'hooks/'
- BRemove all related files from 'components/'
- CDelete the 'problems' folder inside 'features/'
- DDelete the 'problems' folder and related files in 'components/'
2.A developer wants to colocate a component's styles and tests. Where should these files be placed?
- AIn a separate 'styles/' and 'tests/' folder
- BIn a global 'assets/' directory
- CIn a parallel directory under 'src/'
- DBeside the component in the same folder
3.While reviewing a React project, you notice a hook 'useProblems' is placed in 'components/'. What should be done?
- ACreate a separate 'hooks/' directory
- BPlace it in 'utils/' for better access
- CMove it to the 'problems' feature folder
- DLeave it in 'components/' as it might be shared
4.A new developer suggests creating a 'constants.js' file for all constants. What is a better approach?
- AUse a global 'constants.js' for all constants
- BPlace constants next to what uses them
- CDefine constants in a separate 'data/' folder
- DStore constants in a 'config/' directory
5.You find a shared component importing from a feature folder. What does this indicate?
- AThe import is correct for shared components
- BThe component should be moved to the feature folder
- CThe component should be duplicated in the feature
- DThe feature folder should be restructured
6.What naming convention should be used for a React component file?
- AcamelCase
- Bsnake_case
- Ckebab-case
- DPascalCase
7.A developer places a hook 'useAuth' in 'hooks/' for a single screen. What is the recommended practice?
- APlace it in 'utils/' for better access
- BCreate a separate 'authHooks/' directory
- CKeep it in 'hooks/' for potential reuse
- DMove it beside the screen using it
8.Why is it recommended to use named exports for components?
- AThey make the codebase more secure
- BThey reduce file size
- CThey are faster to import
- DThey allow for safer renaming and better autocompletion