ApiKeysController.tsx 452 B

12345678910111213141516171819
  1. import { FC, useCallback, useState } from 'react';
  2. interface Api {
  3. isAdding: boolean;
  4. toggleIsAdding: () => void;
  5. }
  6. interface Props {
  7. children: (props: Api) => JSX.Element;
  8. }
  9. export const ApiKeysController: FC<Props> = ({ children }) => {
  10. const [isAdding, setIsAdding] = useState<boolean>(false);
  11. const toggleIsAdding = useCallback(() => {
  12. setIsAdding(!isAdding);
  13. }, [isAdding]);
  14. return children({ isAdding, toggleIsAdding });
  15. };