Back to search

Context API basics, Provider/Consumer, useContext, and Context vs prop drilling

Context lets a value be shared through a subtree without manually threading props through every intermediate component.

React Easy Theory

Context API basics, Provider/Consumer, useContext, and Context vs prop drilling

Context lets a value be shared through a subtree without manually threading props through every intermediate component.

  • Provider supplies the value
  • Consumers or useContext read it
  • Context is useful for truly shared cross-cutting values

Context API basics, Provider/Consumer, useContext, and Context vs prop drilling