It is my first day with react native, I am working with mangodb, I stored record in db and fetched record, now I want to show in flatlist, and need to setState() but it throws error of undefined
db.find({}, function (err, docs) {
this.setState({ dataSource: docs });
});
docs is array of users and I am able to print data in console, its working, but problem is how do I set this data in datasource using setState.