Skip to content

Commit

Permalink
refactor: ErrorProvider에서 useError를 파일로 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
pakxe committed Aug 16, 2024
1 parent dafaa91 commit 8fd839a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 83 deletions.
83 changes: 0 additions & 83 deletions client/src/ErrorProvider.tsx

This file was deleted.

12 changes: 12 additions & 0 deletions client/src/hooks/useError/useError.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {useContext} from 'react';

import {ErrorContext, ErrorContextType} from './ErrorProvider';

// 에러 컨텍스트를 사용하는 커스텀 훅
export const useError = (): ErrorContextType => {
const context = useContext(ErrorContext);
if (!context) {
throw new Error('useError must be used within an ErrorProvider');
}
return context;
};

0 comments on commit 8fd839a

Please sign in to comment.