DEV Community

Discussion on: React Hooks Dependencies and Stale Closures

Collapse
 
lexlohr profile image
Alex Lohr

The use case here is if you only depend on the value of the variable at the time the effect runs.

This can actually be a performance benefit, as you do not render more often than necessary.

Otherwise, you should be aware that you are creating a potential tripwire.