timarney / react-app-rewired

Override create-react-app webpack configs without ejecting
MIT License
9.81k stars 425 forks source link

React Hook eslint? #477

Closed yolinsoft closed 4 years ago

yolinsoft commented 4 years ago

React Hook "useState" is called in function "pointRelPath" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter.

dawnmist commented 4 years ago

This is an error regarding your source code, and isn't related to react-app-rewired.

React has special handling for any function starting with "use", and as such create-react-app have defined some eslint rules that check for any code that clashes with their special handling.

Somewhere, you have a function called useState that is conflicting with React's special handling.

Edit: reading the message, it looks like you're importing and using React's useState function inside something that is not itself a react component. It can only be used inside React function components or other custom hook functions.