함수를 부른다 > render를 다시한다 > 또 함수를 부른다 > 반복
함수를 부른다? : {} 블럭안에 함수명+() 이렇게 썼기때문에 바로 호출의 의미라서 무한이 걸림!
-> 무한 루프에 걸리는 코드...
<button onClick={this._toggleState}>메뉴</button> //Wrong
따라서 이렇게 사용해야 함!
<button onClick={() => this._toggleState(param)}>메뉴</button> //Correct
출처: https://kss7547.tistory.com/36
React.js - 이벤트 Error: Maximum update depth... 해결법
Error: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to preven..
kss7547.tistory.com
'Etc > Error' 카테고리의 다른 글
Sourcetree에서 403 오류 발생 (0) | 2023.02.02 |
---|---|
[Spring] "unreported exception IOException" in stream/forEach (0) | 2022.02.08 |
[Error] Unhandled Rejection (SecurityError): Blocked a frame with origin "주소" from accessing a cross-origin frame. (0) | 2022.01.25 |
[Github] 사용자 아이콘이 회색(알 수 없는 유저)로 나오는 문제 (0) | 2022.01.12 |
[Java] non-static method cannot be referenced from a static context (0) | 2022.01.12 |