UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

25 lines (20 loc) 455 B
import {useCallback, useState} from 'react' interface DialogControls { show: () => void hide: () => void visible: boolean } export function useDialogVisible(): DialogControls { const [dialogVisible, setDialogVisible] = useState(false) const hide = useCallback(() => { setDialogVisible(false) }, []) const show = useCallback(() => { setDialogVisible(true) }, []) return { visible: dialogVisible, show, hide, } }