You need to follow two rules in order to use hooks,
The eslint plugin named eslint-plugin-react-hooks can be used to enforce these two rules.