diff --git a/.changeset/orange-steaks-trade.md b/.changeset/orange-steaks-trade.md new file mode 100644 index 0000000..e96b9f4 --- /dev/null +++ b/.changeset/orange-steaks-trade.md @@ -0,0 +1,5 @@ +--- +"@wethegit/react-modal": patch +--- + +fix: ensures empty params doesn't throw diff --git a/package.json b/package.json index 219d427..12afb4e 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "prepare": "node -e \"try { require('husky').install() } catch (e) {if (e.code !== 'MODULE_NOT_FOUND') throw e}\"", "start": "vite", "build": "rm -rf dist && vite build", + "changeset": "changeset", "version": "changeset version", "release": "npm run build && changeset publish", "lint:scripts": "eslint --report-unused-disable-directives --max-warnings 0 --ext .tsx,ts --ignore-path .gitignore .", diff --git a/src/lib/hooks/use-modal.ts b/src/lib/hooks/use-modal.ts index ae98759..50a931e 100644 --- a/src/lib/hooks/use-modal.ts +++ b/src/lib/hooks/use-modal.ts @@ -16,7 +16,8 @@ export interface UseModalOptions { hash?: string } -export function useModal({ triggerRef, hash }: UseModalOptions) { +export function useModal(props: UseModalOptions) { + const { triggerRef, hash } = props || {} const [state, setState] = useState(ModalStates.CLOSED) const handleClose = useCallback(() => {