codestates / codestates/Pointrip

[Error Handling] 이름 / 에러 유형

Open
#75 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

> ### 어떤 에러인가요?
>
> ### 에러 메시지
> ```shell
> src/pages/CreatPost/EditPost/EditPost.tsx
> Line 222:5: React Hook "useEffect" is called in function "registerPost" that is
> neither a React function component nor a custom React Hook function.
> React component names must start with an uppercase letter.
> React Hook names must start with the word "use" react-hooks/rules-of-hooks
>
>Search for the keywords to learn more about each error.
> ```
> ```shell
> src/pages/CreatPost/EditPost/EditPost.tsx
> Line 222:5: React Hook "useEffect" is called in function "registerPost" that is neither
> a React function component nor a custom React Hook function.
> React component names must start with an uppercase letter.
> React Hook names must start with the word "use" react-hooks/rules-of-hooks
>
> Search for the keywords to learn more about each error.
> ```
> ```jsx
> ERROR in src/routes/index.tsx:46:45
>
> TS2786: 'EditPost' cannot be used as a JSX component.
> Its return type 'void' is not a valid JSX element.
> 44 | } />
> 45 | } />
> > 46 | } />
> | ^^^^^^^^
> 47 | {/* 전역적으로 관리될 필요까지는 없어서 tab으로 mypage를 나눔. */}
> 48 |
> 49 |
>
> ```

>
> ### 에러 핸들링 방법
> * 핸들링 방법에 대해서 간단하게 기록해보세요.
> 컴포넌트 내 함수를 정의한 부분에서 } 로 닫지 않고, return 이 끝나는 부분 위치한 } 를 함수의 닫음으로 인식해 발생한 문제였습니다.
> ```js
> function EditPost() {
> ...
> const registerPost = async () => {
> // } 에러 원인! } 이 누락되어 변수를 닫지 못했던 것입니다.
> return (
> ...
> )
> }
> }
> ```
>
> ### 에러 핸들링을 위해 참고한 레퍼런스 링크
> 링크 https://bobbyhadz.com/blog/react-cannot-be-used-as-a-jsx-component

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.