Skip to content

Instantly share code, notes, and snippets.

@Aslemammad
Last active July 13, 2020 09:32
Show Gist options
  • Save Aslemammad/2326b9335c6331cb0ef161d8463b63ff to your computer and use it in GitHub Desktop.
Save Aslemammad/2326b9335c6331cb0ef161d8463b63ff to your computer and use it in GitHub Desktop.
Bad example
const HomePage = () => {
const [isDeleteModalOpen, setDeleteModal] = useState(false)
const [isConfirmModalOpen, setConfirmModal] = useState(false)
return (
<div>
<Modal isOpen={isDeleteModalOpen}>
Code here...
</Modal>
<Modal isOpen={isConfirmModalOpen}>
Code here...
</Modal>
Code here...
<button onClick={() => setDeleteModal(true)}>Show delete modal</button>
<button onClick={() => setConfirmModal(true)}>Show confirm modal</button>
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment