UNPKG

@mui/x-tree-view

Version:

The community edition of the MUI X Tree View components.

16 lines (15 loc) 867 B
'use client'; import _formatErrorMessage from "@mui/x-internals/formatErrorMessage"; 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(process.env.NODE_ENV !== "production" ? 'MUI X Tree View: Could not find the Tree View context. ' + 'This happens when a component is rendered outside of a SimpleTreeView or RichTreeView parent component. ' + 'Ensure your component is a child of a Tree View component. ' + 'This can also happen if you are bundling multiple versions of the Tree View.' : _formatErrorMessage(190)); } return context; };