swsnu / swppfall2022

Learning Software Engineering By Building Web Services
30 stars 10 forks source link

[HW3] Invalid hook call warning #99

Open GitHae1337 opened 2 years ago

GitHae1337 commented 2 years ago

현재 코드 자체에 문제는 없는 것 같은데 react-router-dom Package 내 함수를 활용하고자 하면 invalid Hook Call Warning이 발생합니다

이와 관련해서 다음과 같은 해결책을 찾았는데 정확히 어떻게 진행해야 하는지 이해가 가지 않아서 문의 드립니다. https://stackoverflow.com/a/70474994/13275659 https://stackoverflow.com/a/72145184/13275659

혹시나 해서 package.json 파일 코드와 "npm ls" 입력 결과 남깁니다 { "name": "skeleton", "version": "0.1.0", "private": true, "proxy": "http://localhost:8000", "dependencies": { "@reduxjs/toolkit": "^1.8.5", "@testing-library/jest-dom": "5.16.5", "@testing-library/react": "13.4.0", "@testing-library/user-event": "13.5.0", "@types/jest": "27.5.2", "@types/node": "16.11.59", "@types/react": "18.0.20", "@types/react-dom": "18.0.6", "enzyme": "3.11.0", "json-server": "0.17.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-redux": "^8.0.4", "react-scripts": "5.0.1", "typescript": "4.8.3", "web-vitals": "2.1.4" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "backend": "cp api/db.json api/_db.json && json-server --watch api/_db.json --routes api/routes.json --port 8000 --host 0.0.0.0" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } }

2022-10-07 15_51_22-package json - swpp-hw3-keetae423 - Visual Studio Code

GitHae1337 commented 2 years ago

hw3 파일을 그대로 다운 받아서 로컬에서 진행했는데 왜 실습 파일에서는 동일한 코드가 작동하고 숙제 파일에서는 작동하지 않는 것인지 아시는 분 답변 부탁드립니다

gajagajago commented 2 years ago

please refer to #72