Created
July 26, 2019 09:53
-
-
Save CITGuru/77d43cb5e546d2cda8ecc646b8b4af98 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
export const useModalWithData = ( | |
initialMode = false, | |
initialSelected = null | |
) => { | |
const [modalOpen, setModalOpen] = useModal(initialMode) | |
const [selected, setSelected] = useState(initialSelected) | |
const setModalState = state => { | |
setModalOpen(state) | |
if (state === false) { | |
setSelected(null) | |
} | |
} | |
return { modalOpen, setModalOpen, selected, setSelected, setModalState } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment