ReasonReact hooks exhaustive deps checks



Greetings everyone,
I am playing with a small toy webapp with ReasonReact frontend + Reason Apollo Hooks + Rust backend. Honestly, it is a pretty fun and pleasant experience!

Unfortunately, I just had a hard time fixing a silly bug, where a useCallback hook was not taking all its dependencies as second argument. I totally understand that this is how React works, but with ReasonML we don’t have all the linting environment developed for JS (and for good reasons!), and in this case we inherit the issues without the tooling.

Do you know if there is some sort of typed abstraction to avoid these pitfalls? If not, do you think that it could be possible/worth implementing something related? Maybe using a ppx? I am asking because I am pretty new with the language, and maybe someone already worked on this specific issue… Thank you!


I wonder if that could be a job for reanalyze. Maybe try filing an issue there, see what they say :slight_smile:


I think it has been recommended in the past to use React’s hooks linter for this. It’s not statically typed of course, but it is a real-world answer to the problem, for now.


Interesting, I did not think about that. It is not the end of the world to stick an eslint run after bsb. Thanks!

In any case, I opened an issue in the reanalyze repo as suggested by @hoichi.