본문 바로가기

React

(7)
[React] yarn add 여러개 하나하나가 아닌 한꺼번에 설치하고싶을경우 yarn add 이름 이름 이름 뒤에 띄어쓰기로 연결시켜준뒤 실행
[React] inner style important 적용 ref = {(e) => { if (e) { e.style.setProperty('width', '10px', 'important');} }}
[REACT] Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of <tr>. Make sure you don't have any extra whitespace between tags on each line of your source code. 결론 : 코드 사이에 모든 공백을 제거하면 더이상 콘솔경고 나지 않음 ex ) {head} {head}
[REACT] (SingleDatePicker) Warning: Failed prop type: Invalid prop `date` of typ Warning: Failed prop type: Invalid prop `date` of type `object` supplied to `withStyles(SingleDatePicker)`, expected `Moment`. at withStyles(SingleDatePicker) (eval at ES6ProxyComponentFactory → 데이터에 null값이 들어가서 생긴 이슈 date={this.state.date && !this.state.date == false ? this.state.date : null} date에 들어갈 값을 예외처리 이중으로 해줌. (※ !this.state.date == false !(값) == false 값이 존재함 = null, ' ', undefined값을 같..
[REACT] getDerivedStateFromProps - Cannot read properties of undefined (reading 'setState') getDerivedStateFromProps - render이전 그리기 직전에 호출 정적 메서드 이기 떄문에 this.setState 를 사용할 경우 "Cannot read properties of undefined (reading 'setState')" 이와 같은 에러가 발생한다. 대신 return 값을 이용해서 state값을 변경시키면 된다. static getDerivedStateFromProps(nextProps, prevState) { if (nextProps.value !== prevState.value) { //값이 다를경우 console.log("로그") //prevState 의 상태값을 return으로 변경 return { value : "변경할 값"} return null; // 아무것..
yarn install 안될경우 yarn install 설치시 에러날 때 체크항목 1. cmd모드로 본인 경로로 들어가서 yarn install 진행 2. 관리자 cmd모드로 본인경로로 들어가서 yarn install 진행 3. powershell 로 들어가서 실행
error An unexpected error occurred: "https://registry.yarnpkg.com/material-design-icons/-/material-design-icons-3.0.1.tgz: ESOCKETTIMEDOUT.... 내 pc > 사용자 > pc이름 으로 들어가서 .yarnrc 폴더로 이동 하단에 network-timeout 600000 추가 후 저장 후 재실행