I am currently working on a simple todo crud app. I just cannot seem to get my data to be put out on the screen.
const Home = () => {
  const [todos,setTodos] = useState([]);
  const getTodos = async () =>{
    const querySnapshot = await getDocs(collection(db, "todos"));
    
    querySnapshot.forEach((doc) => {        
      setTodos([...todos,doc.data()])
      console.log(doc.data())
      console.log(todos)
    });  
  }
  useEffect(()=>{  
    getTodos();    
  },[])
  return (    
    <div>Home</div>
  )
}
Now the console.log(doc.data()) shows every dataset alright, but the todos array either gets just the first value assigned or returns an empty array.
Any ideas?
 
     
     
    