Consuming context
📖 Scenario: You are building a simple React app that shares a theme color across components using React Context.
🎯 Goal: Create a React component that consumes a ThemeContext to display text in the theme color.
📋 What You'll Learn
Create a React context called
ThemeContext with the value { color: 'blue' }Create a component called
ThemedText that uses useContext to get the theme colorRender a
<p> element inside ThemedText with the text 'This text is themed!'Apply the theme color as the text color style on the
<p> element💡 Why This Matters
🌍 Real World
Sharing theme or user settings across many components without passing props manually.
💼 Career
Understanding React Context is essential for managing global state and theming in modern React apps.
Progress0 / 4 steps