useModal

useModal provides automatic binding for component Modal, which can reduce the amount of repetitive code and improve the development experience. Using this hooks behaves the same as if you had added React.useState manually.

This hooks also supports use on Select component.

General

Use hooks to control Modal.

APIs

useModal

type useModal = (initialVisible: boolean) => {
  visible: boolean
  setVisible: Dispatch<SetStateAction<boolean>>
  currentRef: MutableRefObject<boolean>
  bindings: {
    visible: boolean
    onClose: () => void
  }
}

;