I am having problem after using the usestate()Hook for state manipulation.
Failed to compiled errors:
./src/App.js
Line 6:43: React Hook "useState" is called in function "app" which is neither a React function component or a custom React Hook function react-hooks/rules-of-hooks
Line 14:39: React Hook "useState" is called in function "app" which is neither a React function component or a custom React Hook function react-hooks/rules-of-hooks
Search for the keywords to learn more about each error.
This error occurred during the build time and cannot be dismissed.
This errors is showing in my terminal also:
Could not open App.js in the editor.
The editor process exited with an error: spawn sublime_text ENOENT.
The rules of hook plugin uses naming conventions to tell what is a component, what is a hook, and what is a regular function. Functions beginning with a capital letter are assumed to be components. Functions beginning with use
are assumed to be hooks. Your function apparently is named app
, which is neither, so it's assumed to be neither.
Assuming app
is a component, the fix is to change its name to App
.
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.