codestates / codestates/Pointrip

[Error Handling] 이름 / 에러 유형

Offen
#75 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
0
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

> ### 어떤 에러인가요?
>
> ### 에러 메시지
> ```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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Inspect src/pages/CreatPost/EditPost/EditPost.tsx around line 222 and the EditPost route in src/routes/index.tsx at line 46. Verify the function braces and confirm that the React Hooks and JSX component errors no longer occur; the documented missing closing brace is the stated resolution.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
react, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
20/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.