Skip to content

Commit

Permalink
fix: 커스텀 훅 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
urjimyu committed May 29, 2024
1 parent 21dfffd commit e64f533
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/hooks/useNavigateHome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { useNavigate } from 'react-router-dom';

const useNavigateHome = () => {
const navigate = useNavigate();
navigate('/');
return <></>;
const navigateHome = () => {
navigate('/');
};
return navigateHome;
};

export default useNavigateHome;
3 changes: 2 additions & 1 deletion src/pages/CompletePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import Button from '../components/Button';
import useNavigateHome from '../hooks/useNavigateHome';

const CompletePage = () => {
const navigateHome = useNavigateHome();
return (
<CompletePageWrapper>
<Title>서비스를 탈퇴 완료</Title>
<Subtitle>
그동안 레코드림을 이용해주셔서 <br /> 감사합니다.
</Subtitle>
<Button message="확인" onClick={useNavigateHome} />
<Button message="확인" onClick={navigateHome} />
</CompletePageWrapper>
);
};
Expand Down
11 changes: 10 additions & 1 deletion src/pages/ErrorPage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
import Button from '../components/Button';
import useNavigateHome from '../hooks/useNavigateHome';

const ErrorPage = () => {
return <div>에러가 발생했습니다!</div>;
const navigateHome = useNavigateHome();
return (
<div>
<span>에러가 발생했습니다!</span>
<Button message="홈으로 이동" onClick={navigateHome} />
</div>
);
};

export default ErrorPage;
3 changes: 2 additions & 1 deletion src/pages/UnregisteredPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import useNavigateHome from '../hooks/useNavigateHome';
import Button from '../components/Button';

const UnregisteredPage = () => {
const navigateHome = useNavigateHome();
return (
<UnregisteredPageWrapper>
<Title>가입된 회원이 아닙니다.</Title>
<Button message="확인" onClick={useNavigateHome} />
<Button message="확인" onClick={navigateHome} />
</UnregisteredPageWrapper>
);
};
Expand Down

0 comments on commit e64f533

Please sign in to comment.