Skip to content

Instantly share code, notes, and snippets.

@jogilvyt
Created April 19, 2021 14:14
Show Gist options
  • Save jogilvyt/0289ed8e3281ff60774c3eefe82d553d to your computer and use it in GitHub Desktop.
Save jogilvyt/0289ed8e3281ff60774c3eefe82d553d to your computer and use it in GitHub Desktop.
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