DEV Community

Discussion on: Update boolean state right with React Hooks

Collapse
 
ivoberger profile image
Ivo

a note: eslint react hook rules don't complain about a state setter created by setState as a missing dependency as it never changes. So while it doesn't hurt, an empty dependencies array would work just fine in this case.

Collapse
 
alexkhismatulin profile image
Alex Khismatulin

Sounds good. I would put anything I use into dependencies for consistency but it’s a good note for those who feels better when the dependencies array is empty. Thank you!