codestates / codestates/BanThing
[Error Handling] state를 너무 많이 업데이트 할 경우 에러
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
### 어떤 에러인가요?
- Too many re-renders. React limits the number of renders to prevent an infinite loop.
```
if (typeof window !== 'undefined') {
let shortThan768 = false;
if (window.innerWidth <= 768) {
shortThan768 = true;
} else {
shortThan768 = false;
}
setClientWidth(shortThan768);
setSlide(mapTomobileUp);
}
console.log(clientWitdh);
```
애니메이션을 라이브러리로 사용하여 media query를 사용하지 못하여 클라이언트의 넓이 다를 경우 애니메이션의 작동 여부를 설정하려고 하였습니다만 콜스택 에러가 발생하였습니다.
### 에러 핸들링 방법
- 클라이언트의 innerWidth가 다를 경우 다른 것을 렌더링하게 수정하였습니다.
```
if (window.innerWidth <= 768)
```
### 에러 핸들링을 위해 참고한 레퍼런스 링크
- Memory-It 의 Error Handling 예시입니다.
[링크](https://github.com/codestates/Memory-It/issues/205)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.