Failed to compile React Hook "useQuery" is called in function "home" which is neither a React function component or a custom React Hook function

Viewed 1022

My react app is showing the below error in browser

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
1 Answers

I saw the below warning

Warning: The tag <home> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.

and changed the <home/> to <Home/>

This fixed the issue!

PS: All React component names must start with a capital letter. If you start a component name with a lowercase letter, it will be treated like a built-in element like a or a . This is because of the way JSX works.

Related