Context
✓ Published1🌍 Public
This example demonstrates the React Context API for sharing a user name across components. It shows a large, centered text message ("Joe") rendered by a `UserProfile` component, which consumes the context value. The code defines a `UserContext` with `Provider` and `Consumer` exports, and uses `UserProvider` to supply the value. The rendering relies on React's `createContext` and `useContext` hooks, with the `UserConsumer` passing the context to a paragraph element. The tight coupling between `App.js` and `User.js` overrides the provider value, resulting in the displayed name.
AI-generated descriptionReact Starter code.
MIT Licensed