OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Problem running react-native app via Expo go on ios and android TypeError: Object.groupBy is not a function (it is undefined)

  • Thread starter Thread starter art_hq
  • Start date Start date
A

art_hq

Guest
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

Code:
  const preData = Object.groupBy(filtredProdList, (prod) => {
    return prod.categories[0].name;
  });

Code:
 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 added import { 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

<p>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</p>
<pre><code> const preData = Object.groupBy(filtredProdList, (prod) => {
return prod.categories[0].name;
});

</code></pre>
<pre><code> ERROR TypeError: Object.groupBy is not a function (it is undefined)
</code></pre>
<p>tried some workarounds:</p>
<ul>
<li>added <code>"node": "^21.6.1"</code> to package.json > dependencies</li>
<li>installed core-js via <code>npm i core-js</code> and then added <code>import { groupBy } from "core-js/actual/array/group-by";</code></li>
<li>installed <code>npm i typescript@next</code></li>
</ul>
<p>additional question is it possible to look somewhere which js function will work and which not?</p>
<p>p.s. - i understand that it is relatively new feature and i could use reduce instead</p>
 

Latest posts

Online statistics

Members online
0
Guests online
4
Total visitors
4
Top