Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 使用firebase时出现权限错误_Reactjs_Firebase_Firebase Realtime Database_Firebase Security - Fatal编程技术网

Reactjs 使用firebase时出现权限错误

Reactjs 使用firebase时出现权限错误,reactjs,firebase,firebase-realtime-database,firebase-security,Reactjs,Firebase,Firebase Realtime Database,Firebase Security,上面是我在尝试将数据插入firebase db时遇到的错误的快照 constructor(props) { super(props); this.app = firebase.initializeApp(DB_CONFIG); this.database = this.app.database().ref().child('notes'); this.state = { notes : [], } } componentWillMount() {

上面是我在尝试将数据插入firebase db时遇到的错误的快照

constructor(props) {
   super(props);
   this.app = firebase.initializeApp(DB_CONFIG);
   this.database = this.app.database().ref().child('notes');
   this.state = {
     notes : [],
   }
}

componentWillMount() {
   const prevNotes = this.state.notes;

   this.database.on('child_added', snap => {
      prevNotes.push({
        id: snap.key,
        data: snap.val().data,
      })

   this.setState({ notes: prevNotes });
   })
}

addNote(e) {
  if(e.which === 13) {
    this.database.push().set({ data: e.target.value });
  }
}
上面是react代码,我正在使用它向db添加注释,我正在制作一个待办事项列表,addNote()将在按ENTER键时添加一个新注释


请帮我解决这个问题,我是第一次使用firebase,是否有任何代理问题可能导致此问题?

问题已经解决,我只是想为数据库中的读/写规则设置为真,firebase实际上有两种类型的dbs Cloud firestore和实时数据库。。实际上,我为云数据库设置了true,并认为我为实时数据库设置了true