DEV Community

Harit Himanshu
Harit Himanshu

Posted on

1

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

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)

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more