Prop drilling là tình trạng phải truyền props qua nhiều tầng component trung gian, dù những component đó không thực sự sử dụng props đó — chỉ đóng vai trò chuyển tiếp.
Điều này làm code khó bảo trì và khó refactor.
Giải pháp phổ biến gồm:
- Context API cho state toàn cục đơn giản như theme hoặc user info,
- Redux hoặc Zustand cho state phức tạp cần nhiều nơi truy cập,
- composition pattern — truyền JSX làm children thay vì truyền data qua props
Nên chọn giải pháp phù hợp với quy mô dự án, không nên dùng Redux cho mọi trường hợp.
Prop drilling is when you must pass props through multiple intermediate component layers that don't actually use those props — they just forward them.
This makes the code hard to maintain and refactor.
Common solutions:
- Context API for simple global state like theme or user info;
- Redux or Zustand for complex state accessed in many places;
- composition pattern — pass JSX as children instead of passing data through props
Choose the solution appropriate for your project scale; Redux is not the right answer for every case.