[Error handling] 'Switch' is not exported from 'react-router-dom'
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
> > 해결된 에러라면 라벨에 'Complete' 를 달아주세요.
> > 미해결된 에러라면 라벨을 'In progress' 로 변경해주세요.
>
> ### 어떤 에러인가요?
> upstream 병합 중 잘 실행되는지 확인해보았는데 위와 같은 에러가 나왔습니다.
>
> ### 에러 메시지
```
Switch is not exported from 'react-router-dom
```
>
> ### 에러 핸들링 방법
>
- 에러 원인
검색 결과 'react-router-dom'에서 'Redirect'를 내보내지 않아서 리엑트 라우터 돔 버전 6에서 'Redirect 구성 요소가 제거되었기 떄문이라고 한다.
- 해결 방법
두 가지 방법이 있었습니다. 첫 번째는 component를 element로 고치면 된다.
```js
} />
} />
```
하지만 이방법은 모든 라우터 설정을 엘리먼트로 고쳐야 되기 떄문에 시간이 너무 아까웠다 그래서 두번 째 방법을 사용해서 짧은 시간에 해결 하게 되었다. 방법은 npm에서 기존 라우터 돔을 삭제하고 5버전 대의 리엑트 라우터 돔을 새로 설치하면 해결 되었다.
정말 알다가도 모를... 시행 착오를 자꾸 겪게 된다..
> ### 에러 핸들링을 위해 참고한 레퍼런스 링크
> [링크1](https://velog.io/@kcdoggo/Switch-is-not-exported-from-react-router-dom-%EC%97%90%EB%9F%AC)
> [링크2](https://stackoverflow.com/questions/63124161/attempted-import-error-switch-is-not-exported-from-react-router-dom?rq=1)
>[링크3](https://pretagteam.com/question/how-to-fix-the-error-attempted-import-error-navlink-is-not-exported-from-reactrouterdom)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.