In the example code, useExit is not following the rules of hooks. I think that it is ok because it is not a real hook, but in this case, it could be named differently.
After running ESLint with eslint-plugin-react-hooks, I am getting this error:
27:9 error React Hook "useExit" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function react-hooks/rules-of-hooks
A possible workaround is to rename useExit in the import:
- import { Text, useExit, useInput } from "react-curse";
+ import { Text, useExit as exit, useInput } from "react-curse";
In the example code,
useExit
is not following the rules of hooks. I think that it is ok because it is not a real hook, but in this case, it could be named differently.After running ESLint with
eslint-plugin-react-hooks
, I am getting this error:A possible workaround is to rename
useExit
in the import: