Vizzuality/landgriffon

View on GitHub
client/src/hooks/modals/index.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { useState } from 'react';

import type { UseModalProps } from './types';

export function useModal(): UseModalProps {
  const [isOpen, setIsOpen] = useState(false);

  const open = (): void => {
    setIsOpen(true);
  };

  const close = (): void => {
    setIsOpen(false);
  };

  return {
    isOpen,
    open,
    close,
  };
}

export default useModal;