can't handle this error any suggestions?
import "./App.css"; import { navigate, useRoutes } from "hookrouter"; const routes = { "/": () => <h1>home</h1>, "/news": () => <h1>news</h1>, }; function App() { const page = useRoutes(routes); return <div>{page || alert("not found")}</div>; } export default App;
this is app.js only this component exists nothing more then this also package.json and i think everything is okay but anyway returning invalid hook call but have no idea why
{
"name": "weather",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"@types/hookrouter": "^2.2.5",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"web-vitals": "^1.1.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"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"
]
}
}
Have you tried to install the package before using it!
use this command to install the package
npm i hookrouter
//or if you're using yarn try this:
yarn add hookrouter
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.