Skip to content

useDialogContext

import { useDialogContext } from 'react-dialog-async';

This hook is intended to be called within a dialog component that is rendered via useDialog(). It provides access to the same set of props that are passed to the dialog component.

This allows for building reusable components such as a <Dialog/> component that can read isOpen from context rather than requiring it to be passed down as a prop.

const MyDialog = (props: AsyncDialogProps) => {
// dialogContext exposes all of the same props as AsyncDialogProps
const dialogContext = useDialogContext();
return ...
}
function useDialogContext<D,R>(): IndividualDialogStateContextValue<D, R>

None

Extends AsyncDialogProps

PropertyTypeDescription
isInsideDialogContextbooleanIf true, this indicates the hook is being called inside of a dialog rendered with useDialog()

View on GitHub