Skip to content
Learn Netverks

Lesson

Step 27/36 75% through track

prop-drilling-intro

Introduction to prop drilling

Last reviewed May 28, 2026 Content v20260528
Track mode
client_react
Means
In-browser React TSX
Reading
~2 min
Level
intermediate

This lesson

An orientation to the React track—how the playground works, vocabulary, and what you will build next.

You need a clear map of the React track so hooks, state, and tooling do not feel like magic.

You will apply Introduction to prop drilling in contexts like: SPAs, dashboards, design-system-driven products, and React Native mobile apps.

Write TypeScript/TSX, click Run in browser—React 18 loads from CDN, JSX compiles in the tab, UI renders in the preview root, and printOutput feeds the terminal. Also read the interview prep blocks.

After solid JavaScript—and ideally TypeScript—before starting the react track.

Prop drilling is passing data through intermediate components that do not use it—only forward props to a deep child. It is normal for shallow trees; it becomes painful when five layers only relay user or theme.

Symptoms

  • Layout shells grow huge prop lists unrelated to their UI
  • Refactors require touching many files to rename a prop
  • Intermediate components re-render when drilled props change

Remedies (preview)

  • Component composition — pass children or render props so layout does not know about data
  • Context — share cross-cutting values (theme, auth) without every layer listing props
  • Custom hooks + colocation — fetch or select data where it is consumed when possible

Drilling is not automatically wrong—explicit data flow is easy to trace. Reach for context when traceability cost exceeds clarity benefit.

Important interview questions and answers

  1. Q: What is prop drilling?
    A: Passing props through components that do not need them to reach a descendant.
  2. Q: First alternative to try?
    A: Composition (children/slots) or colocating state; then context for truly global cross-cutting data.

Self-check

  1. Why is explicit drilling sometimes preferable to context?
  2. How does composition reduce drilling for a toolbar action?

Challenge

Spot the relay layer

  1. Run the demo and change the theme in the deepest panel.
  2. Identify which middle component only forwards theme.
  3. Describe one refactor that removes that relay.

Done when: you can name the pass-through layer and suggest composition or context.

Tip: Try composition (children) before context—often the layout shell does not need the drilled prop at all.

Interview prep

When is prop drilling acceptable?

Shallow trees with a few layers. Fix with composition or context when intermediate components only pass props through.

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs in your browser in a sandboxed frame. Backend runners appear when this track’s profile allows them.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Drilling depth ok?
  • Context alternative?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump