A simple modal to display some customizable text, built with react
react-simple-modal-cb
Here is the first NPM Package I built and I made it for my OpenClassroom’s course.
I developped a simple modal to display some customizable text with a close button on it.
It requires React Hooks useState to works and some defined props.
Here is an exemple followed by the confiiguration steps to add this package into your project.
Configuration
- Open your terminal into your project and do
npm i react-simple-modal-p14
- Import the modal package with
import { Modal } from "react-simple-modal-p14"
into your file - Set your text props with
const setText = string
inside your component - Set modal’s trigger anywhere you want to call it with
setShowModal(true)
- To close the moddal define
setShowModal(false)
anywhere you want to close it - Set the modal with props into your component by copy/past the following code
<Modal text={setText} show={showModal} onClose={handleOnClose} />
License
MIT © CB23