Usually you don’t want to disable the rule. However, there are few cases where it’s worthwhile to disable it.
For example, if you’re doing a fetch on mount and you’re sure it never has to execute again, you can disable it with the code below.
// eslint-disable-next-line react-hooks/exhaustive-deps
First, confirm the rule is wrong. It has been battle tested and most of the time it’ll be right. You can introduce subtle bugs by ignoring the dependencies.
You can also disable the rule globally, although that’s not recommended.