rfa
Version:
**React Form Architect** is an ultimate solution for creating and rendering forms in React. Its main focus is to provide users with a tool to define, render and share a form in a browser.
11 lines (7 loc) • 346 B
text/typescript
import { useCallback, useState } from "react";
export const useDialog = (init = false): [boolean, () => void, () => void] => {
const [open, setOpen] = useState<boolean>(init);
const handleOpen = useCallback(() => setOpen(true), []);
const handleClose = useCallback(() => setOpen(false), []);
return [open, handleOpen, handleClose];
};