I am creating a project where the data is been fetched from Firebase and the whole UI is working fine but a error is coming which is
Compiled with warnings.
src/Myproject.js
Line 16:7: React Hook useEffect has a missing dependency: 'fetchDB'. Either include it or remove the dependency array react-hooks/exhaustive-deps
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
but if we see the code
// Code...
const [allProjects,getAllProjects] = useState([
{
coverImg: null,
dateOfpublish: "--/08/2021",
demo: null,
summary: "To showcase my skills",
tag: "react",
title: "Portfolio"
}])
const fetchDB = async() =>{
const getdata = db.collection('projects');
const data = await getdata.get();
data.docs.forEach(project=>{
getAllProjects([...allProjects,project.data()])
})
}
useEffect(()=>{
fetchDB();
},[])
// Code...
I can't find where it is going wrong...
this issue is closely related to this Issue but still, the solutions are given there are still not fixing my issue.
Whole code is there on Github