@mui/x-tree-view
Version:
The community edition of the MUI X Tree View components.
22 lines (21 loc) • 986 B
JavaScript
;
'use client';
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useTreeViewContext = exports.TreeViewContext = void 0;
var React = _interopRequireWildcard(require("react"));
/**
* @ignore - internal component.
*/
const TreeViewContext = exports.TreeViewContext = /*#__PURE__*/React.createContext(null);
if (process.env.NODE_ENV !== "production") TreeViewContext.displayName = "TreeViewContext";
const useTreeViewContext = () => {
const context = React.useContext(TreeViewContext);
if (context == null) {
throw new Error(['MUI X: Could not find the Tree View context.', 'It looks like you rendered your component outside of a SimpleTreeView or RichTreeView parent component.', 'This can also happen if you are bundling multiple versions of the Tree View.'].join('\n'));
}
return context;
};
exports.useTreeViewContext = useTreeViewContext;