Skip to content

Why useEffect warns for the fields that I do not need to put in the dependencies array?

harittweets profile image Harit Himanshu twitter logo github logo ・1 min read

I have gone through the useEffect documentation and I do not understand why I get warning for every variable and function that I use inside useEffect, but I have no dependency on them.

Consider my useEffect here

const [updatedComm, setUpdatedComm] = useState<ICommunication>(props.comm)
const [isEditOn, setIsEditOn] = useState<boolean | false>(false)
twitter logo DISCUSS
markdown guide
Classic DEV Post from Aug 4 '19

You're not worth hiring unless...

Harit Himanshu profile image
I am hands-on software professional with more than a decade of experience in building and shipping products at companies of small to large sizes. contributed in Advertising,CleanTech,Security,FinTech