在地图内循环

This is My console.log

结果证明是首先是Console 2学生,然后所有数据都翻了一番

我想要的是拥有

学生1 { 数据:H3FX ..,数据:I3ui ..,数据:RdYS ..,.... }

学生2 {data:H3FX ..,data:I3ui ..,data:RdYS ..,....}

我对反应渲染和语法这么多次感到困惑。

`this.state.allStudent.map(student => {
      console.log('student:'+student.id);
      studentid = student.id
      db.doc(this.props.location.state.userCourse).collection('assignment').get().then( snapshot =>{
          snapshot.forEach(doc=>{
            db.doc(this.props.location.state.userCourse).collection('assignment').doc(doc.id).collection('student').get().then(query=>{
              query.forEach(querysnapshot=>{
                if(querysnapshot.data().studentid == student.id){
                  console.log('data:'+doc.id)
                }
              })
            })
          })
      })
    })`