0.1.3 • Published 11 months ago
react-modal-hrnet-mthomas v0.1.3
HRnet
react-modal is a react library allowing to create a modal with a title and content
Install the lib
- Go to the npm site via this link https://www.npmjs.com/package/react-modal-hrnet-mthomas
- Open the terminal then run the command npm i react-modal-hrnet-mthomas
Use the lib
- Call at the top of your component import { Modal } from 'react-modal-hrnet-mthomas';
- Call the modal via
- The modal takes 3 parameters
- title: string
- content: string REQUIRED
- handleModal: boolean REQUIRED
- Here is an example of use:
import { useState } from 'react';
import { Modal } from 'react-modal-hrnet-mthomas';
export function ModalExample() {
const [modal, setModal] = useState(false);
return (
<>
{modal && (
<Modal
title='Employee created!'
content='The employee you created is now available in the "employee list" tab'
handleModal={setModal}
/>
})
<button onClick={setModal(true)}>Open modal<button/>
</>
);
}
/!\Make sure you have Node.js installed on your machine
Team
Developer - Minor Thomas
NPM: https://www.npmjs.com/package/react-modal-hrnet-mthomas