Developing mobile app with React-Native and Expo encounter an issue when try to run code on my ios 15.7.5 iphone 6s and pixel3a emulator on android 12, while web version works fine
const preData = Object.groupBy(filtredProdList, (prod) => {
return prod.categories[0].name;
});
ERROR TypeError: Object.groupBy is not a function (it is undefined)
tried some workarounds:
- added
"node": "^21.6.1"
to package.json > dependencies - installed core-js via
npm i core-js
and then addedimport { groupBy } from "core-js/actual/array/group-by";
- installed
npm i typescript@next
additional question is it possible to look somewhere which js function will work and which not?
p.s. – i understand that it is relatively new feature and i could use reduce instead