라우터 설치,Unexpected use of 'location' no-restricted-globals
2022. 5. 13. 16:52ㆍWeb/React
1. 페이지 이동을 위해 npm install react-router-dom을 설치하고 코드도 계속해서 보았는데 설정한 path대로 URL이 출력되지 않고 빈 화면만 나왔다. 구글로 서치하던 중에 기존에 설치했던 react-router-dom을 uninstall하고 npm install react-router-dom@5 로 했더니 원하던 결과가 출력되었다.
2.
Unexpected use of 'location' no-restricted-globals
의 경우 스택오버플로우를 참고해보니 location 변수를 사용하는 곳 위에
// eslint-disable-next-line no-restricted-globals 를 추가하라고 한다.
그대로 따라해보니 리액트에서 오류메시지는 뜨지 않았다.