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
Contextobject usingcreateContext() - Built a Context Provider that wrapped child components and passed values
- Used
useContextto 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)