modal-plugin-tp
v0.1.4
Published
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
Downloads
6
Readme
A simple Modal React component plugin
This project was bootstrapped with Create React App.
Description
This plugin was publish to https://www.npmjs.com/package/modal-plugin-tp to be reusable.
Project Prerequisites :
- React >=15.0.1
How to install :
npm install modal-plugin-tp
How to use :
- Import the component in your file
import Modal from "modal-plugin-tp";
- Create a state using useState hook
const [isOpenModal, setIsOpenModal] = useState();
- To make it close by default and open on click you can do like so :
{
isOpenModal && (
<Modal onClose={() => setIsOpenModal(false)}>
<div className="success-create">
Employee has been created successfully !
</div>
</Modal>
);
}
Props :
- children
Define the content of the modal
- onClose
A function used to close the modal by setting the state of "isOpenModal" to false with "setIsOpenModal"