import React, { useState } from "react";
import "./styles.css";
import Modal from "react-modal";
Modal.setAppElement("#root");
export default function App() {
const [isOpen, setIsOpen] = useState(false);
function toggleModal() {
setIsOpen(!isOpen);
}
return (
<div className="App">
<button onClick={toggleModal}>Open modal</button>
<Modal
isOpen={isOpen}
onRequestClose={toggleModal}
contentLabel="My dialog"
>
<div>My modal dialog.</div>
<button onClick={toggleModal}>Close modal</button>
</Modal>
</div>
);
}