#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
6 min read
Question 10 of 48medium

useContext Hook

Sharing state without prop drilling.

What is Context?

Context provides a way to pass data through the component tree without passing props manually at every level.

When to Use Context

  • Theme data (dark/light mode)
  • User authentication
  • Language preferences
  • Any global state

Context API Steps

  1. Create context with createContext
  2. Provide value with Provider
  3. Consume with useContext