UNPKG

556 BJavaScriptView Raw
1import { createContext, useContext } from "react";
2/** @private */
3export const dayPickerContext = createContext(undefined);
4/**
5 * Return the context to work with `<DayPicker />` inside custom components.
6 *
7 * @group Hooks
8 * @see https://daypicker.dev/guides/custom-components
9 */
10export function useDayPicker(props) {
11 const context = useContext(dayPickerContext);
12 if (context === undefined) {
13 throw new Error("useDayPicker() must be used within a custom component.");
14 }
15 return context;
16}
17//# sourceMappingURL=useDayPicker.js.map
\No newline at end of file