modal-library-kv
v0.3.2
Published
React Modal Component
Downloads
7
Readme
modal-library-kv
Made with create-react-library
Install
npm install modal-library-kv
Usage
import React from 'react'
import { Modal } from 'modal-library-kv'
import 'modal-library-kv/dist/index.css'
import { useEffect, useState } from "react";
export default function Component() {
const [openModal, setOpenModal] = useState(false)
useEffect(() => {
if (openModal) {
window.addEventListener('click', () => setOpenModal(false));
return () => window.removeEventListener('click', () => setOpenModal(false));
}
});
return (
<>
{openModal ? <Modal /> : null}
</>
)
}
License
MIT © kevinverres