Skip to content

Commit

Permalink
feat: (#55) 컴포넌트를 열고 닫는 커스텀 훅 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
inyeong-kang committed Jul 17, 2023
1 parent 168452a commit 3bfe1f3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions frontend/src/hooks/useToggle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useState } from 'react';

export const useToggle = () => {
const [isOpen, setIsOpen] = useState(false);

const openComponent = () => {
setIsOpen(true);
};

const closeComponent = () => {
setIsOpen(false);
};

return { isOpen, openComponent, closeComponent };
};

0 comments on commit 3bfe1f3

Please sign in to comment.