Hooks Folder Conventions & Test Co-location
Create a simple hooks convention (prefix use*, keep pure logic), place hooks in feature folders, and keep tests next to the units they verify.
Why hooks conventions?
Goal: Keep hooks tidy and testable.
- Prefixes: use*
- Pure logic inside hooks; UI outside
- Co-locate tests near units
Folder layout idea
- features/counter/useCounter.js
- features/counter/CounterPanel.jsx
- features/counter/useCounter.test.jsx
- ui/Button.jsx
All lessons in this course
- Feature Folders & UI vs Composite Components
- Hooks Folder Conventions & Test Co-location
- Refactoring Guidelines