The old way to read context, before useContext existed.
React Docs
import { UserContext } from './user-context';function Avatar() { return ( <UserContext.Consumer> {user => <img src={user.profileImage} alt={user.name} />} </UserContext.Consumer> );} Copy
import { UserContext } from './user-context';function Avatar() { return ( <UserContext.Consumer> {user => <img src={user.profileImage} alt={user.name} />} </UserContext.Consumer> );}
Generated using TypeDoc
The old way to read context, before useContext existed.