DEV Community

Usman Butt
Usman Butt

Posted on

Day 10–12 of My React Journey – Context API

Days 10–12, I focused on React Context API, which provides a way to manage state globally in a React app.

What I Learned

  • Created a Context object using createContext()
  • Built a Context Provider that wrapped child components and passed values
  • Used useContext to consume values in another component
  • Practiced sending values from Component One ➝ consuming them in Component Two

Why Context API?

Normally, React apps require prop drilling to send data down through multiple components. Context API removes that complexity by creating a global store that any component can access.

This makes it perfect for:

  • Theme switching
  • Authentication & user data
  • Global app settings

Tech Used

  • React
  • Context API (createContext, useContext)

Top comments (0)