hook 의 규칙

김윤진·2022년 5월 2일
0

문제해결

목록 보기
8/9

React Hook "useInputDispatch" is called in function "handleFirstPartCardNumberInput" 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 Hook "useInputDispatch"는 React 함수 구성 요소나 사용자 정의 React Hook 함수가 아닌 "handleFirstPartCardNumberInput" 함수에서 호출됩니다. React 컴포넌트 이름은 대문자로 시작해야 합니다. React Hook 이름은 "use"라는 단어로 시작해야 합니다.


오직 React 함수 내에서 Hook을 호출해야 한다

Hook을 일반적인 JavaScript 함수에서 호출하면 안 된다

  • React 함수 컴포넌트에서 Hook을 호출하면 된다

  • Custom Hook에서 Hook을 호출해야 한다

0개의 댓글