Custom hooks có thể gọi custom hooks khác, tạo composable layers.
Ví dụ: useUser gọi useFetch, useCache, useAuth. Pattern này giống function composition, cho phép xây dựng complex behaviors từ simple hooks. Giữ mỗi hook single-responsibility, tránh hooks quá fat có nhiều trách nhiệm không liên quan.
Custom hooks can call other custom hooks, creating composable layers.
- For example, useUser can call useFetch, useCache, and useAuth internally.
- This mirrors function composition and allows building complex behaviors from simple, focused hooks.
- Keep each hook single-responsibility — avoid bloated hooks with multiple unrelated concerns.