0.1.5 • Published 2 years ago

modale-custom-react v0.1.5

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Content of the modal

To display the modal, just create a state:

const toggle, setToggle = useState(false)

And a closeModal function:

const closeModal = () => {
    setToggle(false)
}

Then the modal is displayed or not depending on the value of toggle:

return( 
    <>
    {toggle 
        ?
        <Modal
            close = {closeModal}
            text = "Your text"
        />
        : 
        null
    }
    </>
)

Github: https://github.com/AdrienW86/Modal.git