에러노트 20

[에러노트] Type 'undefined' is not assignable to type 'Element'.

vue에서 lottie-web을 써서 아래 코드를 작성함 const lottieRef = ref(null); onMounted(() => { lottie.loadAnimation({ container: lottieRef.value, renderer: 'svg', loop: true, autoplay: true, animationData: animationLoading, }); }); 여기서 container 부분에서 빨간줄이 떴다. Type 'undefined' is not assignable to type 'Element'. 이런 에러가 떴다. undefined를 잡으면 null 문제라고 또 떴다. 이것을 해결하는 방법은 const lottieRef = ref(null); onMounted(() => ..

에러노트 2023.03.23

[에러노트] Failed to load config "react-app" to extend from.

타입스크립트로 되어있는 리액트 프로젝트에서 prettier설정을 해서 자동 저장이 되게 하고 싶었다. 평소 하던대로 .eslintrc.json파일에 { "extends": ["react-app", "plugin:prettier/recommended"] } 이것을 추가해주었는데 에러가 났다. 다른 블로그에서는 아래를 설치해주라고 한다. npm install eslint-config-react-app or yarn add eslint-config-react-app 하지만 나의 문제는 이것이 아니었나 보다. 나는 .prettierrc.js파일을 만들고 module.exports = { printWidth: 125, bracketSpacing: true, jsxBracketSameLine: true, singl..

에러노트 2022.11.30

[에러노트] react form에서 onKeyPress 2번 실행되는 문제

이렇게 상품 바코드 스캔 부분에 숫자를 치고 엔터를 누르거나 찾기를 누르면 서버 get 요청을 보내는 것을 만들고 있었다. [문제] api가 2번 요청됨 [해결 1 - 실패] http .get(`/서버 api?something=something`) 이렇게 되어있던 요청을 http .get(`/서버 api `, { params: { something: something, }, }) 이렇게 바꾸었다. 어떤 페이지에서는 되는데 어떤 페이지에서는 그래도 2번 호출이 일어났다. [해결2 - 실패] onKeyPress(e)} fullWidth /> 찾기 react-hook-form에서 formState를 가져와서 disabled설정을 해주었다. 이러니까 버튼은 항상 disabled이다. 엔터를 눌렀을 떄는 요청이 ..

에러노트 2022.05.02

[에러노트] A component is changing an uncontrolled input to be controlled. ...

[문제발생] A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: [원인] select option에 undefined가 들어가는 문제 때문인듯 [해결] 값이 없을 때 '' empty string이 들어가도록 해주기 value={value|| ''}

에러노트 2022.04.01

[에러노트] Request failed \"401 Unauthorized\" yarn add 401 error / npm 401 error

[원인] 내 오류는 private repository에 토큰 설정이 안되어있어서 auth에러가 난 것이었다. [해결 방법] vi ~/.npmrc 터미널에서 위의 코드를 쳐서 들어간다. //npm.pkg.github.com/:_authToken=내토큰 깃허브의 setting> developer setting> personal access tokens 를 만들고 토큰값을 넣는다. :wq 저장하고 빠져나온다. yarn install 이제 잘 된다!

에러노트 2022.01.11