所以我一直在开发一个 react native 应用程序,就像 meetups 应用程序一样。它有自己的 node.js 后端,可以在这里查看 https://github.com/rahullakhaney/meetup/tree/master/meetup-backend 在我的应用程序中,我试图从我的数据库中填充组,我得到此错误“可能未处理的承诺拒绝 (id:0) null 不是对象”
这是我的 api.js 文件
import axios from 'axios';
axios.defaults.baseURL = 'http://localhost:3000/api';
const fakeGroupId = '58d64e3a122149dd3cdba5d8';
class MeetupApi {
constructor() {
this.groupId = fakeGroupId;
this.path = `/groups/${this.groupId}/meetups`;
}
async fetchGroupMeetups() {
const { data } = await axios.get(this.path);
return data.meetups;
}
}
export {
MeetupApi
};
您还可以在https://github.com/rahullakhaney/meetup/tree/master/meetup-mobile查看完整代码
任何人都可以解释为什么我会收到这个错误,对不起,但我是新来的反应原生。