dalaoque / react-modal-manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-modal-manager

Usage

import { Button, Modal } from 'antd'
import ReactModalManager, { showModal, closeModal } from '@momenta/react-modal-manager'

...

const DemoModal = ({ id, closeModal }) => (
  <Modal title="Basic Modal" visible={true} onOk={closeModal} onCancel={closeModal}>
    <p>Content...</p>
  </Modal>
)



const App = () => (
  <div>
    <Button onClick={() => showModal(<DemoModal />)}>Show Modal</Button>
    <ReactModalManager />
  </div>
)

ReactDOM.render(<App />, document.getElementById('root'))

or

const modalId = showModal(<DemoModal />)
closeModal(modalId)

...

About


Languages

Language:JavaScript 94.4%Language:EJS 5.6%