UNPKG

@mui/x-date-pickers

Version:

The community edition of the MUI X Date and Time Picker components.

17 lines (15 loc) 680 B
'use client'; import _formatErrorMessage from "@mui/x-internals/formatErrorMessage"; import * as React from 'react'; export const PickerContext = /*#__PURE__*/React.createContext(null); /** * Returns the context passed by the Picker wrapping the current component. */ if (process.env.NODE_ENV !== "production") PickerContext.displayName = "PickerContext"; export const usePickerContext = () => { const value = React.useContext(PickerContext); if (value == null) { throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: The `usePickerContext` hook can only be called inside the context of a Picker component' : _formatErrorMessage(151)); } return value; };