modal-maker
v0.1.5
Published
This is a componant react to display in full screen or hide a modal according to the submit.
Downloads
5
Maintainers
Readme
What is it?
This is a componant react to display in full screen or hide a modal according to the submit.
Install
npm i modal-maker
Usage
After installing the package, import useState and ModalMaker
import { useState } from 'react'
Then copy/past this hook into the parent component of this modal:
const [isModalOpen, setIsModalOpen] = useState(false)
component usage
<MyComponent isOpen = {isModalOpen} closeModal= {closeModal}/>
Example of use:
import React, { Component, useState } from 'react'
import MyComponent from 'react-modal'
function Exemple() {
const [isModalOpen, setIsModalOpen] = useState(false)
function openModal(){
setIsModalOpen(true);
}
function closeModal(e){
e.preventDefault();
setIsModalOpen(false)
}
return(
<MyComponent isOpen = {isModalOpen} closeModal= {closeModal}/>
)
}
License
MIT © damienpellet