0PricingLogin
React Academy · Lesson

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

  1. Feature Folders & UI vs Composite Components
  2. Hooks Folder Conventions & Test Co-location
  3. Refactoring Guidelines
← Back to React Academy