![](/img/trans.png)
[英]React Hook "useState" is called in function "setResults" which is neither a React function component or a custom React Hook function
[英]Failed to compile React Hook “useQuery” is called in function “home” which is neither a React function component or a custom React Hook function
我的反應應用程序在瀏覽器中顯示以下錯誤
Failed to compile
./src/pages/home.js
Line 24:30: React Hook "useQuery" is called in function "home" which is neither a React function component or a custom React Hook function react-hooks/rules-of-hooks
我看到了以下警告
Warning: The tag <home> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.
並將<home/>
更改為<Home/>
這解決了問題!
PS:所有 React 組件名稱必須以大寫字母開頭。 如果您以小寫字母開頭的組件名稱,它將被視為像 a 或 a 這樣的內置元素。 這是因為 JSX 的工作方式。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.