Once I run the below code, I get the following error:
React Hook useEffect has a missing dependency: \'list\'. Either include it or remove the depende
The dependency array
- it's the second optional parameter in the useEffect
function. React will recall function defined in the first parameter of useEffect
function if parameters inside dependency array
will changed from the previous render.
Then you doesn't need to place list
variable inside dependency array
.
useEffect(() => {
// do some
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [term]);