Closed osrl closed 9 months ago
Is there nicer a way to check if a modal is open on the page globally? I'm currently using below method
const modals = useContext(NiceModal.NiceModalContext); const isModalOpen = Object.keys(modals).length > 0
But this requires a new component inside the NiceModal.Provider.
This is the proper way. You can create a custom hook to do the check. Then just use the hook anywhere.
Is there nicer a way to check if a modal is open on the page globally? I'm currently using below method
But this requires a new component inside the NiceModal.Provider.