@mui/x-tree-view
Version:
The community edition of the MUI X Tree View components.
15 lines (14 loc) • 664 B
JavaScript
'use client';
import * as React from 'react';
/**
* @ignore - internal component.
*/
export const TreeViewContext = /*#__PURE__*/React.createContext(null);
if (process.env.NODE_ENV !== "production") TreeViewContext.displayName = "TreeViewContext";
export 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;
};