@atlaskit/avatar
Version:
An avatar is a visual representation of a user or entity.
13 lines (12 loc) • 499 B
JavaScript
import { createContext, useContext } from 'react';
/**
* Used to ensure Avatar sub-components are used within a Avatar component,
* and provide a useful error message if not.
*/
export var EnsureIsInsideAvatarContext = /*#__PURE__*/createContext(false);
export var useEnsureIsInsideAvatar = function useEnsureIsInsideAvatar() {
var context = useContext(EnsureIsInsideAvatarContext);
if (!context) {
throw new Error('Avatar sub-components must be used within a Avatar component.');
}
};