Created
April 19, 2021 14:14
-
-
Save jogilvyt/0289ed8e3281ff60774c3eefe82d553d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const App = () => { | |
const [isModalOpen, setIsModalOpen] = useState(false); | |
return ( | |
<div className="App"> | |
<h1>Try opening the modal</h1> | |
<button onClick={() => setIsModalOpen(true)}>Open the modal</button> | |
{isModalOpen ? ( | |
<Modal> | |
<Modal.Header>This is a modal</Modal.Header> | |
<Modal.Body> | |
<p>Inside it is some information</p> | |
<p>You can render whatever JSX you want in here</p> | |
</Modal.Body> | |
<Modal.Actions> | |
<button onClick={() => setIsModalOpen(false)}>Cancel</button> | |
<button onClick={() => alert("You have accepted!")}>Accept</button> | |
</Modal.Actions> | |
</Modal> | |
) : null} | |
</div> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment