0.1.2 • Published 5 years ago

react-hooks-modal v0.1.2

Weekly downloads
13
License
-
Repository
-
Last release
5 years ago

react-hooks-modal

NPMVersion

React Hooks for Modal

Install

npm i react-hooks-modal

The Gist

import { useModal } from 'react-hooks-modal'
import { Button, Modal } from 'antd'

function App() {
  const { visible, show, hide } = useModal()
  return (
    <Button onClick={show}>Show Modal</Button>
    <React.Fragment>
      <Modal
        visible={visible}
        onClose={hide}
      >
        <span>A modal</span>
      </Modal>
    </React.Fragment>
  )
}

License

MIT © Randy