1.0.2 • Published 2 years ago
mm-simple-modal v1.0.2
mm-simple-modal
Made with create-react-library
https://www.npmjs.com/package/mm-simple-modal
Install
npm install --save mm-simple-modal
Usage
This is a simple example of mm-simple-modal. You have to set a state for the modal and closeModal function in the parent component.
import React, { useState } from 'react'
import Modal from 'mm-simple-modal'
import 'mm-simple-modal/dist/index.css'
const App = () => {
const [showModal, setShowModal] = useState(false)
const closeModal = () => {
showModal && setShowModal(false)
}
return (
<div className='App'>
<h1>React Modal</h1>
<button className='btn' onClick={() => setShowModal(true)}>
show Modal
</button>
<Modal show={showModal} onCloseModal={closeModal}>
Message in Modal
</Modal>
</div>
)
}
Props
Props | Type | Required | Default | Description |
---|---|---|---|---|
show | Bool | Required | False | State allows you to display the modal |
onCloseModal | Function | Required | - | Function allows you to remove the modal |
children | String | Required | - | Add content modal |
License
MIT © MouniaFT