티스토리 뷰
리액트 라우터를 사용해서 컴포넌트를 불러오는데 이렇게 쓰니까 오류가 남
<Route path="/rock-scissors-paper" component={RSP}/>
--------------------------------------------------------------
Matched leaf route at location "/rock-scissors-paper" does not have an element.
Matched leaf route at location "/rock-scissors-paper" does not have an element.
해당 위치에 일치하는 엘리먼트가 없다
<Route path="/rock-scissors-paper" element={<RSP />} />
component를 element로 고쳐서 입력하면 잘 작동함
react-router-dom버전이 6인지 5인지 확인해볼것!
6이면 component가 사용이 안되서 위 방법대로 element를 써야하는 것 같음
5이면 component 사용 가능!
npm i react-router-dom@5.3.0 으로 설치하면 됨!
참고
https://stackoverflow.com/questions/69854011/matched-leaf-route-at-location-does-not-have-an-element
Matched leaf route at location "/" does not have an element
Matched leaf route at location "/" does not have an element. This means it will render an with a null value by default resulting in an "empty" page //App.js File import {
stackoverflow.com
댓글 확인
https://www.youtube.com/watch?v=veXqpfcis0A&list=PLcqDmjxt30RtqbStQqk-eYMK8N-1SYIFn&index=64
'에러 노트' 카테고리의 다른 글
- Total
- Today
- Yesterday
- vue
- 구름에듀
- 깃
- 파이썬
- html
- 제이쿼리
- 코딩앙마
- 김버그
- js
- 비주얼스튜디오코드
- scss
- React
- 제로초
- 리액트
- 스파르타코딩클럽
- javascript
- 자바스크립트
- Python
- 코드잇
- vscode
- 드림코딩
- 회고
- 타입스크립트
- TS
- Typescript
- CSS
- git
- 저스트코드
- Til
- map
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |