import { FC, useCallback, useState } from 'react'; interface Api { isAdding: boolean; toggleIsAdding: () => void; } interface Props { children: (props: Api) => JSX.Element; } export const ApiKeysController: FC = ({ children }) => { const [isAdding, setIsAdding] = useState(false); const toggleIsAdding = useCallback(() => { setIsAdding(!isAdding); }, [isAdding]); return children({ isAdding, toggleIsAdding }); };