11 lines
366 B
TypeScript
11 lines
366 B
TypeScript
import { useContext } from "react";
|
|
import { DialogStateContext, DialogStateContextValue } from "./DialogStateProvider";
|
|
|
|
export function useDialogState() : DialogStateContextValue {
|
|
const context = useContext(DialogStateContext);
|
|
if(!context){
|
|
throw new Error("useDialogState must be used within a DialogStateProvider");
|
|
}
|
|
|
|
return context;
|
|
} |