0👍
✅
const documentData = snapshot.docs.map(d => {'key':d.id,'value':d.data()});
The problem with this snippet of code is that in a lambda expression, {}
is interpreted as a block of statements rather than an object. In order to fix this, simply surround the object notation with parenthesis like so
const documentData = snapshot.docs.map(d => ({'key':d.id,'value':d.data()}));
Source:stackexchange.com