Type alias Consumer<T>

The old way to read context, before useContext existed.

See

React Docs

Example

import { UserContext } from './user-context';

function Avatar() {
return (
<UserContext.Consumer>
{user => <img src={user.profileImage} alt={user.name} />}
</UserContext.Consumer>
);
}

Type Parameters

  • T

Generated using TypeDoc