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.

Preview
See code

APIs

useModal

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

Previous

useMediaQuery

Next

useScale

MADE & DESIGNED WITHBY BRUNO ANDRADE
docs background gradient blue
docs background gradient violet