BugDict/React

BugDict/React

[React] Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. 에러 해결

문제상황: Nomad Coders의 트위터 클론코딩 강의의 #6.0 Cleaning JS (08:54) 의 github코드를 사용하여 테스트해보는 중 Home화면에서 Profile로 넘어가는 버튼 클릭시 1. Warning: Cannot update a component (`App`) while rendering a different component (`Unknown`). To locate the bad setState() call inside `Unknown` 2. Profile.js에서 Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or ..

BugDict/React

[React] export 'useHistory' (imported as 'useHistory') was not found in 'react-router-dom' 해결

문제상황: Nomad Coders의 트위터 클론코딩 강의의 #2.6 Log Out (06:37) 를 듣던 중 Profile.js에서 export 'useHistory' (imported as 'useHistory') was not found in 'react-router-dom'에러 로그 발생 · Profile.js import React from "react"; import { authService } from "fbase"; import { useHistory } from "react-router-dom"; export default () => { const history = useHistory(); const onLogOutClick = () => { authService.signOut(); his..

BugDict/React

[React] Property 'bgColor' does not exist on type 'ThemedStyledProps<DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, any>'. 해결

문제상황: 노마드 코더 React JS 마스터클래스의 #3.1 DefinitelyTyped에서 typescript를 사용하기 위해 다음과 같은 과정을 거쳤다. 1. typescript 를 설치하기위해 콘솔에 다음 커맨드 입력 --> npm install --save typescript @types/node @types/react @types/react-dom @types/jest 2. App.js,index.js의 확장자를 .tsx로 변경(React typescript를 사용할 경우의 확장자) 3. 기존의 'styled-components'는 typescript가 아닌 javascript로 쓰여있으므로 다음 커맨드 입력--> npm i --save-dev @types/styled-components (@..

BugDict/React

[React] react-jsx-dev-runtime.development.js:117 Warning: Failed prop type: The prop `genres` is marked as required in `Movie`, but its value is `undefined`.

문제상황: 노마드 코더의 ReactJS로 영화 웹 서비스 만들기의 #7.5 React Router 부분에서 에러로그가 뜨며 로딩화면이후의 path="/" route의 Home 컴포넌트가 제대로 실행되지 않았다. 해결방법: import PropTypes from "prop-types"; import { Link } from "react-router-dom"; function Movie({ coverImg, title, summary, genres }) { if(genres){ return ( {title} {summary} {genres.map((g) => ( {g} ))} );}else{ return ( {title} {summary} 장르 없음 ); } } Movie.propTypes = { cover..

Bug Detector
'BugDict/React' 카테고리의 글 목록