Hacker News new | ask | show | jobs
by gyanreyer 1022 days ago
The linting plugin is eslint-plugin-react-hooks[0], which enforces React's "rules of hooks"; it can detect when you access a value inside a React hook and will warn you that you should add it to your dependency array. It enforces some other rules here and there but that's the big one worth caring about the most. I would consider it essential for working with React hooks.

The only downside is that sometimes, the rule can end up being overly aggressive and tell you to add things which you explicitly don't want in your dependency array, but it's helpful probably 95+% of the time and not hard to opt out of or work around as needed.

[0] https://www.npmjs.com/package/eslint-plugin-react-hooks

1 comments

Ok, these are the linting rules I was thinking of when I mentioned this in the other comment: https://news.ycombinator.com/item?id=37410666

As you already mentioned, it's not a silver bullet.