DEV Community

Discussion on: You (probably) don't need that useState + useEffect

Collapse
 
johnsawiris profile image
John Sawiris • Edited

Good article.👍
Though, there's one thing that I gotta mention. You don't need to include the state setters functions that are returned from useState in the useEffect dependency array, the reason being
that these function are guaranteed to have a stable signature between renders.

Collapse
 
townofdon profile image
Don Juan Javier

Good catch! I think the exhaustive-deps eslint rule used to complain if setter fncs were not included, so I just got into the habit if included everything in the dependency array, but you're absolutely correct (and eslint plugins have gotten a lot better over the years).