A drawer component for React.
add warning when drawer context is used outside of scope (#336)
GSMT03649805d7c9
diff --git a/src/context.ts b/src/context.tsindex 97e24de..2b4e89f 100644--- a/src/context.ts+++ b/src/context.ts@@ -59,4 +59,10 @@ export const DrawerContext = React.createContext<DrawerContextValue>({direction: 'bottom',});-export const useDrawerContext = () => React.useContext(DrawerContext);+export const useDrawerContext = () => {+ const context = React.useContext(DrawerContext);+ if (!context) {+ throw new Error('useDrawerContext must be used within a Drawer.Root');+ }+ return context;+};