The Prop Drilling Problem
Why prop drilling hurts maintainability, what provide/inject solves, when to use it.
What Is Prop Drilling
Prop drilling is passing data through many layers of components just to reach a deeply nested one. Each intermediate component must accept and forward the prop even if it never uses it.
A Deep Component Tree
Imagine a tree: App -> Layout -> Page -> Section -> Widget. The Widget at the bottom needs the current theme, but only App at the top knows it.
App
Layout
Page
Section
Widget <-- needs "theme"All lessons in this course
- The Prop Drilling Problem
- provide() in Parent Components
- inject() in Child Components
- Provide/Inject for App-Level State