README
react-hooks-modal
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